dispatchEvent problem on iOS native side

I was trying to use the dispatchEvent method as reported on the official documentation (http://cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/events/)

this.node.dispatchEvent( new cc.Event('foobar', true) );

but on the native iOS side I get the following error:

Error: js_cocos2dx_Event_constructor : Error processing arguments

Where am I going wrong?
Thanks,
Dom

You can only dispatch a custom event, please do the following:

this.node.dispatchEvent( new cc.Event.EventCustom('foobar', true) );

Ok…now it works fine.
Thank you very much.
Dom

You are welcome, but for simple message dispatching, I suggest you to use emit which is much simpler.

dispatchEvent is made for dispatching events in the scene graph, which include a bubbling phase

I chose to use dispatchEvent because I have this nodes structure:

-----------Game
---------------------->Reels
--------------------------------->Reel

and my event will be dispatched from the Reel node to the Game node.
If I have to use the emit method I presume that I have to use an emit like this:

this.node._parent._parent.emit(“foo”);

Is this correct?

If your event rely on the node tree, your usage is perfect, use dispatchEvent can propagate event fired on Reel to Game