Taps going through to other scenes/objects

Is it possible to stop taps travelling through to objects underneath or the next scene?
I have a button on the main screen and when clicking it to change scenes it travels through to the button on the next scene which results in unwanted behaviour.
NB: the buttons from both scenes are centered in the middle of the display.

Returning true or adding the following code has not worked either:
display.getCurrentStage():setFocus( self )
self.isFocus = true

Widget buttons have given me the same unwanted behaviour as my custom button implementation.
[import]uid: 166068 topic_id: 31549 reply_id: 331549[/import]

Yes, doing a

return true

from an eventListener function stops the chain and doesn’t let the touch to propagate through to objects underneath the current one.

on edit: I see you’re doing widgets - I guess the above doesn’t apply unless they put in some method internal to the widget of doing it. But if you have a custom button, returning true should certainly do it. [import]uid: 160496 topic_id: 31549 reply_id: 126035[/import]

doing a ‘return true’ on tap and collision event listeners does not seen to work.
It only seems to work on multi-touch events [import]uid: 166068 topic_id: 31549 reply_id: 126060[/import]

I don’t know about tap, but on touch events it definitely works. [import]uid: 160496 topic_id: 31549 reply_id: 126063[/import]

The “return true” thing works…

What can happen though is you might get a touch/tap event that goes to the background because you missed the actual object you are trying to tap. As a standard rule for my storyboard apps, I put a touch listener on the background image that just returns true so it will stop the event propogation into other scenes.

[import]uid: 19626 topic_id: 31549 reply_id: 126081[/import]

@robmiracle. Thank you, that is exactly what I was looking for :slight_smile: [import]uid: 166068 topic_id: 31549 reply_id: 126186[/import]

Yes, doing a

return true

from an eventListener function stops the chain and doesn’t let the touch to propagate through to objects underneath the current one.

on edit: I see you’re doing widgets - I guess the above doesn’t apply unless they put in some method internal to the widget of doing it. But if you have a custom button, returning true should certainly do it. [import]uid: 160496 topic_id: 31549 reply_id: 126035[/import]

doing a ‘return true’ on tap and collision event listeners does not seen to work.
It only seems to work on multi-touch events [import]uid: 166068 topic_id: 31549 reply_id: 126060[/import]

I don’t know about tap, but on touch events it definitely works. [import]uid: 160496 topic_id: 31549 reply_id: 126063[/import]

The “return true” thing works…

What can happen though is you might get a touch/tap event that goes to the background because you missed the actual object you are trying to tap. As a standard rule for my storyboard apps, I put a touch listener on the background image that just returns true so it will stop the event propogation into other scenes.

[import]uid: 19626 topic_id: 31549 reply_id: 126081[/import]

@robmiracle. Thank you, that is exactly what I was looking for :slight_smile: [import]uid: 166068 topic_id: 31549 reply_id: 126186[/import]