我在init函数里加入
if( ‘touches’ in cc.sys.capabilities ) {
// this is the default behavior. No need to set it explicitly.
cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchesBegan: this.onTouchesBegan
}, this);
} else {
cc.log(“TOUCHES not supported”);
}
在手机上测试,没有监听事件