各位大大,我的触摸事件出了些不得其解的问题,我废话少说直接上我的代码:
var HelloWorldLayer = cc.Layer.extend({
sprite:null,
ctor:function () {
this._super();
var size = cc.winSize;
return true;
},
onEnter:function(){
this._super();
var listener = cc.EventListener.create({
event:cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan:function(touch,event){
console.log(33); //有效
},
onTouchMoved:function(touch,event){
console.log(66); //无效
},
onTouchEnded:function(){
console.log(999); //无效
}
});
cc.eventManager.addListener(listener,this);
}
});
var HelloWorldScene = cc.Scene.extend({
onEnter:function () {
this._super();
var layer = new HelloWorldLayer();
this.addChild(layer);
}
});
以上是我的测试代码,只有触摸按下(began)执行,其中onTouchMoved,onTouchEnded都没有触发!请问大家这是什么原因呢?