It's the little things that'll stump you, like figuring how to quit the app. So many apps make you use the HOME key and then the app continues running in the background. That's really frustrating. Use this line of code to kill your app:
NativeApplication.nativeApplication.exit();
And you'll need this import statement in your document class:
import flash.desktop.NativeApplication;
Another good thing to know is how to access the MENU, HOME and SEARCH keys. To do this, add a keyListener for a keyboard event:
stage.addEventListener(KeyboardEvent.KEY_UP,keyUpListener);
...then:
function keyUpListener(e:KeyboardEvent):void {
if( e.keyCode == Keyboard.MENU ){ }
if( e.keyCode == Keyboard.HOME ){ }
if( e.keyCode == Keyboard.SEARCH ){ }
}
Don't forget to add this to your document class: import flash.ui.Keyboard;
Simples! A few lines to code to help you with your Flash App for Android.
Remember to support Android - Android loves Flash, unlike the iPhone.
Great - thanks a lot for this - very useful
ReplyDeleteWell Done!
ReplyDeleteAmazing!
i have implemented these recomandation and my app does exit when the back, menu or search keys are pressed, but not when the HIME key is pressed. Any suggestions?
ReplyDelete