Hi all,
I'm trying to figure out a way of navigating back to main menu using the android Back/Return key.
Currently I'm using director.lua library to switch from one "scene" (menu) to other scenes "other menus" and I'd like to knwo how I can use
Runtime:addEventListener("key",onKeyEvent) to properly handle navigation.
I guess I'm not fully grasping what's going on, because ussualy the back key will force exit the application.
Typically, you'd do:
1 2 3 4 5 6 7 8 | local function onBackButtonPressed(e) if (e.phase == "down" and e.keyName == "back") then director:changeScene("menu","crossfade") end return true end Runtime:addEventListener( "key", onBackButtonPressed ) |
has anyone got an ideea on how a proper implementation of back button navigation would be done?
Thank you.