touch events persist after scene change (Storyboard)

I’m having the following problem.
I have a main menu scene with several buttons: play, options, etc…
When i hit play, scene changes to first level.
Weird thing is that an object on the new scene displayed in the same place as the play button in the previous scene receives the touch (tap) event (the one made in order to play) an executes its function.
What could i be doing wrong?

I tried placing the Event Listener for this object both in createScene and enterScene (never both at the same time of course) to see if there was any difference, but nothing changes.

Has anyone experienced something similar?? [import]uid: 105206 topic_id: 21324 reply_id: 321324[/import]

You should be removing your touch listeners in your exitScene function :slight_smile: [import]uid: 84637 topic_id: 21324 reply_id: 84462[/import]

Did that too [import]uid: 105206 topic_id: 21324 reply_id: 84516[/import]

Are you purging scenes? [import]uid: 84637 topic_id: 21324 reply_id: 84517[/import]

You could also add a touch listener to the background of your new scene, and just have it return true (that will prevent touches from leaking through the object).

Also, ensure the buttons you are pressing return true in their even listeners so touches don’t leak through as well. If you removed the event listeners properly in your exitScene, those events should no longer listen for touches on those objects. [import]uid: 52430 topic_id: 21324 reply_id: 84575[/import]

I didn’t know about preventing the leak by adding return true… I’ll give it a try, thanks!

Another question.
How do i remove event listeners from widget buttons (i want it to “deactivate” after a few touches) [import]uid: 105206 topic_id: 21324 reply_id: 84646[/import]

@jb
I added this in my creteScene, then in my enterScene but problem persists.
Is this okay?

local function returnTrue(event)
Runtime:removeEventListener(“touch”, returnTrue)
return true
end
Runtime:addEventListener(“touch”, returnTrue)

When using Storyboard, can i add event listeners in create scene or should i add them only in enter scene?
I’m pretty confused lol [import]uid: 105206 topic_id: 21324 reply_id: 84659[/import]