Skip to main content
Inspiring
June 3, 2013
Answered

Android apk game close issue.

  • June 3, 2013
  • 1 reply
  • 1086 views

Hi I have made flash android game, here is issue is, client need a button to close this game, and other option is if user clicks on home botton on tab/Ipad then game must be pause,

right now if user minimise the app it's sound still playing and everything working as it is. How can I capture that user that user minimise the app.

Correct answer Amit Shakya

Thanks for reply kglad,

I already read this before posting this issue, this is not mention on any official page of adobe, but I did it,

I close app on pressing back key and home key,

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE,gameclose)  << on pressing homekey

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys)  <<on pressing back arrow key

private function gameclose(event:Event):void{

     NativeApplication.nativeApplication.exit();

}

private function handleKeys(event:KeyboardEvent):void{

     if(event.keyCode == Keyboard.BACK)

     NativeApplication.nativeApplication.exit();

}

1 reply

kglad
Community Expert
Community Expert
June 3, 2013
Amit ShakyaAuthorCorrect answer
Inspiring
June 4, 2013

Thanks for reply kglad,

I already read this before posting this issue, this is not mention on any official page of adobe, but I did it,

I close app on pressing back key and home key,

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE,gameclose)  << on pressing homekey

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys)  <<on pressing back arrow key

private function gameclose(event:Event):void{

     NativeApplication.nativeApplication.exit();

}

private function handleKeys(event:KeyboardEvent):void{

     if(event.keyCode == Keyboard.BACK)

     NativeApplication.nativeApplication.exit();

}

kglad
Community Expert
Community Expert
June 4, 2013

both of those events are suggested in the adobe link i posted.