Button in OnEvent calls multiple times composer.gotoScene

Hi! I’m pretty new to corona, so I’m probably doing something wrong. 

I have a button and this button has an OnEvent handle function. This button belongs to a menu that calls an scene to start the game. I noticed that if the user taps pretty fast and multiple times the button, the button event handler gets called multiple times, and this makes my target scene to call multiple times to scene:show and that breaks the dynamic of the game…

This is my handle function:

local function handleButtonEvent( event ) if ( "ended" == event.phase ) then print("handleButtonE") composer.gotoScene( "scene", "crossFade", 300) end return true end

Is there an standard corona way of solving this issue or the only way is adding a flag so I know the button has been already touched and avoid calling it again? 

Thanks a lot!

If you want to prevent multiple taps, you will have to set a flag when you first tap it and then check in your handleButtonEvent to see if that flag is set.

Rob

Thanks!! 

If you want to prevent multiple taps, you will have to set a flag when you first tap it and then check in your handleButtonEvent to see if that flag is set.

Rob

Thanks!!