Skip to main content
Participant
June 5, 2011
Question

Adding a quit function

  • June 5, 2011
  • 1 reply
  • 294 views

Hi there, sorry if this has been asked before. I created a flash game and got into my android phone just fine. The problem is the only way to quit the program is by going into task manager. When I hit the home key it stays running (I can even hear the audio in the game) and theres no option to quit the game when I hit the settings button.

So what do I need to do to make it quit when I hit the home button and is it even possible to add a quit button when you the settings button for an air application?

This topic has been closed for replies.

1 reply

Known Participant
June 5, 2011

if(Capabilities.cpuArchitecture=="ARM"){;

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate);

/*

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys);

you can use this event to add different functions for different buttons like menu, back and search. you cant override the power button or the home button i think

*/

}

private function handleDeactivate(event:Event):void

{

NativeApplication.nativeApplication.exit();

}