求解~~~~
rite.js:37:TypeError: target.removeTouchEventListenser is not a function
addTouchEventListenser:function(){
//创建了一个Touch事件监听器touchListener
this.touchListener = cc.EventListener.create({
//定义这个监听器监听的类型
event: cc.EventListener.TOUCH_ONE_BY_ONE,
//设置是否吃掉事件,事件被吃掉后不会递给下一层监听器
swallowTouches: true,
onTouchBegan: function (touch, event) {
//获取点击坐标
var pos = touch.getLocation();
//获取当前事件的接受者
var target = event.getCurrentTarget();
target.removeTouchEventListenser();
//判断当前的是否点击到了SushiSprite
if ( cc.rectContainsPoint(target.getBoundingBox(),pos)) {
cc.log("touched");
//响应精灵点中
cc.log("pos.x="+pos.x+",pos.y="+pos.y);
target.stopAllActions();
var ac = target.disappearAction;
var seqAc = cc.Sequence.create( ac, cc.CallFunc.create(function () {
cc.log("callfun........");
target.removeFromParent();
},target) );
target.runAction(seqAc);
return true;
}
return false;
}
});
//注册监听器到事件管理器
cc.eventManager.addListener(this.touchListener,this);