Hello everyone! The following code I use on two connecting screens. If I press the Android “back” button right when the scene changes it loads both screens! Has to be a PERFECT click though. Is there a way to delay this function on the second screen so my game has a second to dump the previous screen stuff? Can a global Runtime listener be delayed? Here is my code/ansca sample code:
[lua]local function onKeyEvent( event )
local returnValue = true
local phase = event.phase
local keyName = event.keyName
– Make an exception for Volume Up key and default to it’s normal function (just for show)
if “volumeUp” == keyName then
returnValue = false – use default key operation
end
if “volumeDown” == keyName then
returnValue = false – use default key operation
end
if “back” == keyName then
director:changeScene( “loadback” )
end
– we handled the event, so return true.
– for default behavior, return false.
return returnValue
end
– Add the key callback
Runtime:addEventListener( “key”, onKeyEvent );[/lua]
Thanks for any help! [import]uid: 46082 topic_id: 34680 reply_id: 334680[/import]