Prevent Click event through nodes

I have two nodes (Node A and Node B). Node A has a behavior click event tied to it. When I place Node A under Node B the click event still triggers.
 
Is there a way to prevent this?
 
Thank you!
Has invited:

justinboyd5

Favor from:

Another note, I haven't found a good way to handle event priority in the documentation. Is there a way to change event priority besides removing and adding event listeners?

lijh

Favor from:

You can set Node B interactive too, so Node B will capture the click event before Node A.

justinboyd5

Favor from:

Good point, thank you!
 
What if Node A and Node B both have click behaviors and Node B is a child of Node A? Is there a way to have Node A's click event trigger instead of Node B?

lijh

Favor from:

I suggest you remove Node B from children of Node A, and drag Node B upon Node A :)
 
Besides, I think it's a bit strange, can you explain why you want do that?

justinboyd5

Favor from:

You make a good point! I'm building a card game and I have a Hand object with children Card objects. My objective was to have the Hand contain multiple states (ex. Open Hand and Closed Hand) so users would click on the hand and it would execute some scripts. But each card has click commands on it. I think I'll have to group the items differently. Maybe the Hand will have an empty node contain the Card objects and another empty node to lay over the Card object container so that it can execute state scripts.

To reply to a question, please Login or registered