Hi all,
I’m a newbie, i have a problem
- i have a file GamePlay.js:
cc.Class({extends: cc.Component,
start () { this.node.on('custom_event',function(event){ cc.log('==============this is custom event'); }); },
});
and file Hero.js
cc.Class({ extends: cc.Component,
update: function (dt) { var Custom_Event = new cc.Event.EventCustom('custom_event', true); this.node.dispatchEvent(Custom_Event); },
});
but in gameplay.js can’t recieve event,
who can help me, thanks.