his.touchListener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: true,
onTouchBegan: function (touch, event) {
return true;
},
onTouchMoved : function(touch,event){
},
onTouchEnded : function(touch,event){
var pos = touch.getLocation();
var target = event.getCurrentTarget();
target.BtnMove();
}
});
cc.eventManager.addListener(this.touchListener,this._CombatBtn);
},
添加到了button上面,点击界面任何地方事件都会响应, 报错target.BtnMove() not a function
求大神解答!
BtnTouch : function(sender,type){
switch (type){
case ccui.Widget.TOUCH_MOVED:
case ccui.Widget.TOUCH_ENDED:
this.BtnMove();
}
}
buttons事件这种写法获取target 和 getlocation() 报错 not a function