var luckyGameTypeListener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function (touch, event) {
console.log("Touch Begin");
return true;
},
onTouchEnded: function (touch, event) {
console.log("Touch End");
return true;
}
});
I create the simple EventListener to test the behavior of onTouchBegan and onTouchEnded , i found out that this is event is not simultaneously , The first time i click it only show “Touch Begin”, than I click again it show “Touch End” , the sequence will continue like begin than end than begin and end ,is this the correct behavior of this event or i did something wrong ?
What i am expecting is when the mouse on click it should fire onTouchBegan and when the click is release it show fire onTouchEnded .
var luckyGameTypeListener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function (touch, event) {
console.log(“Touch Begin”);
return true;
},
onTouchEnded: function (touch, event) {
console.log(“Touch End”);
return true;
}
});
Base on this testing ,I found out the behavior of the event is when you first click it will go to onTouchBegan , in order to proceed with onTouchEnded after the onTouchBegan, return true is needed . In order to able to fire back the event onTouchBegin after the onTouchEnded must return a true , so that the next click for onTouchBegin is able to fire.
So on my case early mention , I have left out the return value in onTouchEnd , that why it cause , the Odd number firing.
would appreciate to correct my explanation if there is any mislead or not accurate.