Pass events between nodes

Pass events between nodes


in the canvas I have a script for the control of the swipe in the scene, I would like to pass an event to the player (son node of the canvas) depending on the swipe (it is already implemented) I just need the player’s script to detect those changes to handle the Actions.

I have tried with the event delivery but they are not working in the opposite way (from node a to c)

    if(swipeX > 0){
                    /* left swipe */ 
                    this.node.dispatchEvent( new cc.Event.EventCustom('left', true) );

this.node.on('left', function (event) {


I would like to know too @Big_Bear can help?


This is the right use,you can find it in API document.

this.node.emit('left', {...});


I had already tried it, but that solution does not work for me … I have seen the example project but it does not do it that way, could have some complete example of what I am failing? because the event delivery works perfectly for me but it is not the case that I needed (from A => B not around).


this.node.on('say-hello', function (event) {


this.node.emit('say-hello', {
      msg: 'Hello, this is Cocos Creator',


In your example you should not use event.detail.msg but event.msg . Actually I would call it data instead of event, because with emit function you send only data not the Event type event.