/**
* Author:W
* 触摸事件
*/
cc.Class({
extends: cc.Component,
properties: {
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
this.node.on(cc.Node.EventType.TOUCH_START,function(event){
cc.log("手指触点落在目标节点区域");
});
this.node.on(cc.Node.EventType.TOUCH_MOVE,function(event){
cc.log("手指触点在目标节点区域内移动");
});
this.node.on(cc.Node.EventType.TOUCH_END,function(event){
cc.log("手指触点在目标节点区域内离开");
});
this.node.on(cc.Node.EventType.TOUCH_CANCEL,function(event){
cc.log("手指触点在非目标节点区域外离开屏幕");
});
},
onDestroy(){
this.node.off(cc.Node.EventType.TOUCH_START,function(event){
});
this.node.off(cc.Node.EventType.TOUCH_MOVE,function(event){
});
this.node.off(cc.Node.EventType.TOUCH_END,function(event){
});
this.node.off(cc.Node.EventType.TOUCH_CANCEL,function(event){
});
}
// update (dt) {},
});
触摸事件
最新推荐文章于 2024-08-11 23:46:13 发布