Catch-all listener for touch events

I’m working on a tilemap-based game and I’m thinking it is a lot more efficient if I just create one catch-all touch listener instead of adding a listener for each map element.

From what I’ve seen from the API and the sample apps, you usually attach an event listener to an image or a button. What do I do if I want to catch a touch, say, between (0,0) and (100,100) ?

[import]uid: 7026 topic_id: 4614 reply_id: 304614[/import]

You can attach event listeners to Runtime for global listeners:

Runtime:addEventListener("touch", listener)  

Does anyone know if doing it that way is more efficient? I have listeners added separately to up to 40 tiles and that seems to work fine. [import]uid: 12108 topic_id: 4614 reply_id: 14573[/import]

Thanks for the tip.

In my case a catch-all listener makes sense - I’ll use it for empty tiles.
[import]uid: 7026 topic_id: 4614 reply_id: 14602[/import]

jhocking - I guess you’re right. Setting up individual listeners makes the code a lot clearer. And it isn’t probably any more inefficient than setting up a catch-all listener. Thanks for the tip, though. [import]uid: 7026 topic_id: 4614 reply_id: 14631[/import]