touch events

Hi,

I currently have a runtime listener running in the background of my app:

[lua]Runtime:addEventListener( “touch”, onTouch )[/lua]

This detects touches made on the screen by the user.

I also have another item on the screen, an item called ‘rect’. When rect is tapped, I want a function to be called, so I use an event listener like so:
[lua]rect:addEventListener(“tap”, recttap ) [/lua]

The problem is when pressing my rect, the runtime listener fires as well. Is there any way to change this?
Thanks,

Max [import]uid: 24641 topic_id: 14767 reply_id: 314767[/import]

At the end of your recttap function, add the following line:

[lua]return true[/lua]

This prevents the event from propagating. One issue you might run into is that your Runtime listener is listening for a “touch” event, while rect is listening for a “tap” event. Since those are technically separate events, adding return true might not work, because a touch and a tap could be considered two separate events. You’ll have to test that to find out.

Thanks,
Darren [import]uid: 1294 topic_id: 14767 reply_id: 54656[/import]

Thankyou, i changed the tap event to a touch event and return true worked! thanks a lot [import]uid: 24641 topic_id: 14767 reply_id: 54763[/import]