@Rob --or anyone who can help me
Thank you for your reply. You are an excellent person.
I’ve had more than 30 attempts and this is what I have:
local function onKeyEvent( event ) local phase = event.phase local keyName = event.keyName print( event.phase, event.keyName ) if keyName == "back" and phase == "up" then if composer.getSceneName( "overlay" ) then composer.hideOverlay( "crossFade", 400 ) return true --without this the app close on android back button press else if composer.getScene == "scenes.es.menu\_es" then native.requestExit() return true --without this the app close on android back button press else local lastScene = composer.returnTo --from the official Android-izing tutorial print( "previous scene", lastScene ) if lastScene then composer.gotoScene( lastScene ) return true --without this the app close on android back button press else native.requestExit() end end end end return false end --add the key callback Runtime:addEventListener( "key", onKeyEvent )
and in every scene in the scene:show ==> “will” phase
composer.returnTo = "scenes.es.menu\_es" --\_spanish scenes
or
composer.returnTo = "scenes.en.menu\_en" --\_english scenes
and everything works fine, but in the “scenes.es.menu_es” scene, which is supposed to close the app on android back button press, what it does is a “reload scene” and never a native.requestExit.
Corona Simulator ERROR
What I have in line 409 is
-- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then elseif ( phase == "did" ) then animation1:pause() --line 409 bannerads1:pause() end end
animation1 is a sprite with his respective sequence created in scene:create and forward declared. I play the animation (only one loop, “loopCount = 1”) in the scene:show ==> “will” phase. Also in scene:destroy I nil the sequence, the image sheet reference and the animation1 sprite, just in case.
Its very difficult to me detect what I’m doing wrong cause I’m doing all the code as Corona documentation says.
Thank you for all your attention.