[Resolved] Button hit test priority

Hi guys,
I suppose this is a flash developer asking how to get a flash type work flow out of corona.

Heres the issue I have and I’m interested as to the easiest way around it.

I have a list of items displayed on screen each with there own “tap” type button listener.

I have some functionality that calls up a pop up over that top of this list. Basically a group displaying some information with a close button in it

When a user clicks the Close button the pop up is removed, but the tap events are still picked up for any of the list items. but I dont want them to.

If this was in flash, events assigned to layers above other buttons take priority over below layers.

But in corona an event is fired for both buttons even when on different layers.

whats the best way to stop my listeners for my list items from firing when a pop up appears above them?

thanks [import]uid: 102413 topic_id: 27221 reply_id: 327221[/import]

A very common question, and easily solved. :slight_smile:

At the end of your target listener function (for example, the function that “listens” for the pop-up window’s button presses), just add this:

return true

This tells Corona to stop the touch/tap from propagating through to layers behind it.

Best regards,
Brent Sorrentino
[import]uid: 9747 topic_id: 27221 reply_id: 110584[/import]

Ah thanks Brent,
caunt believe I didn’t see that in the documentation.

Thanks
Aidan [import]uid: 102413 topic_id: 27221 reply_id: 110606[/import]

How would I stop something that isnt a button propagating ?

So for example a group of objects on the layer above some buttons?
…say a pop up.

If a user presses on the group of objects the press event propagates through to the buttons below and those are pressed? [import]uid: 102413 topic_id: 27221 reply_id: 116424[/import]

You could set focus, though I’ve also seen people put up an invisible rect behind the pop up group with a

function whatever()
return true
end
rect:addEventListener(“touch”, whatever)

Something like that would also work. [import]uid: 52491 topic_id: 27221 reply_id: 116489[/import]