1. 回调函数里如果需要传递this,用bind;call会立即调用函数,而不是等待回调。
2.button的点击事件
var clickEventHandler = new cc.Component.EventHandler();
clickEventHandler.target = this.node; // 这个 node 节点是你的事件处理代码组件所属的节点
3.node.stopAllActions(), 只会停止当前节点的action,不会递归子节点。
本文探讨了游戏开发中回调函数使用bind传递this的方法,button点击事件处理及node停止所有action而不递归子节点的特性。
1. 回调函数里如果需要传递this,用bind;call会立即调用函数,而不是等待回调。
2.button的点击事件
var clickEventHandler = new cc.Component.EventHandler();
clickEventHandler.target = this.node; // 这个 node 节点是你的事件处理代码组件所属的节点
3.node.stopAllActions(), 只会停止当前节点的action,不会递归子节点。
809
985

被折叠的 条评论
为什么被折叠?