Touch handling order

Hey!
I just wanted to ask you if I create a touch handler on an element and I add that element to the layer…
Then I add another element with another touch handler to the same place where I picked the previous… Then I touch on that location where the 2 sprites are… Is it possible to handle only the last added sprite’s touch event ( because of it’s z-order )?

My v3.x is a little rusty, but I think what you need to do is:

  • Set swollowTouches to true for BOTH touch handlers.
  • Return true for onTouchBegan if an element is touched. This should mean only the first touched element found will be considered touched.
  • Give different Z orders to both elements so you can decide and know which element is in front.