Children input activates parent input [SOLVED]

Hello i have some troubles with eventType inputs, but well let’s tell you my problem. I’m using a function like this : this.node.on(cc.node.eventType.TOUCH_END, this.anyFunction, this).

It works fine clicking on the node. The problem comes when i create a node which is children of a children of the first node and I use an other input on it, creating it the same way as the first one, but calling a different function since the inputs are on different scripts and I want them to do different things whenever I click onto them.

So, when I click onto the children of a children of the first node, it calls both of the functions, the one called by the parent input and the one called by the children. Is there any way so the children input only calls its function?

Many thanks. :smiley:

Hi, try this, it looks like it could help:
http://www.cocos2d-x.org/docs/creator-api/en/classes/Event.html#stoppropagation

I think that stop propagation is for the mouse click event.
For touches, I guess you have to call the setSwallowTouches(true) on your listener, and after it, your touchStart function should return true.

I dont remember it at all. For a better search in google go “cocos2d swallow touch” or wait for another answer :wink:

@Undume @persy I added the Input block Events component on the child and it worked! Many thanks :blush: