Copy link to clipboard
Copied
I am trying to return a Flash/Animate animation published as Air for Android App from one scene to another using the Android return button/keypress. Is this possible and is there Action Script to enable this. I would be very grateful for any guidance with this issue. Many thanks
Zeb
Copy link to clipboard
Copied
The whole handling the back arrow correctly is a requirement of some of the app stores, especially the Samsung store, so it's good that you're trying to do that.
These lines show the general approach:
//trap the system press of any key
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, fl_OptionsBackHandler);
//check if the key is the back arrow. If the my variable 'atcontents' is true, 'return', which will have the effect of allow Android to exit the app
//if it's not true, do the code to take you to your contents page, and stop the back arrow from reaching Android OS
function fl_OptionsBackHandler(event:KeyboardEvent):void {
if (event.keyCode == Keyboard.BACK) {
if (atcontents) {
return;
} else {
goToContents();
event.preventDefault();
event.stopImmediatePropagation();
}
}
event.preventDefault();
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more