Tap and touch events propagate until they are "handled." This means that if you have multiple objects overlaying each other in the display hierarchy, and a tap or touch event listener has been applied to each, the event will propagate through all of these objects. However, you can stop propagation to the next underlying object by telling Corona that the event has been handled. This is as simple as returning true from the event listener — this stops the propagation cycle and prevents any underlying objects from responding to the hit event.

jdsmedeirosbr

[GLOBAL: userInfoPane.html]

jdsmedeirosbr

Enthusiast

44 posts

Corona SDK

12 July 2018 - 11:35 AM

Hello, I have a rectangle inside a scrollview and when I touch the rectangle, another rectangle appears and I add a tap event on it, I would like to touch the rectangle in it, but my touch event works, but the object does not disappear.

jdsmedeirosbr

nick_sherman

[GLOBAL: userInfoPane.html]

nick_sherman

Corona Geek

1,637 posts

Corona SDK

13 July 2018 - 03:51 AM

On first glance, is it possible that as well as tapping the button, which is then destroyed, the tap also permeates down to the card underneath, triggering the tap function which then redraws the button in exactly the same place?

jdsmedeirosbr

[GLOBAL: userInfoPane.html]

jdsmedeirosbr

Enthusiast

44 posts

Corona SDK

13 July 2018 - 04:04 AM

On first glance, is it possible that as well as tapping the button, which is then destroyed, the tap also permeates down to the card underneath, triggering the tap function which then redraws the button in exactly the same place?

when I put the listener type to "touch" I could see that this is the same, how can I solve this?

Tap and touch events propagate until they are "handled." This means that if you have multiple objects overlaying each other in the display hierarchy, and a tap or touch event listener has been applied to each, the event will propagate through all of these objects. However, you can stop propagation to the next underlying object by telling Corona that the event has been handled. This is as simple as returning true from the event listener — this stops the propagation cycle and prevents any underlying objects from responding to the hit event.