Search code examples
iosiphoneactionscript-3airadobe

IOS AIR app still running when the iphone is locked?


I just made a simple game with flash professional 6.0 and the adobe AIR 4.4 SDK for iPhone.

The problem is that when I lock the iphone pressing the power button, the screen switches off as usual, but the music of the game still sounds. If I exit the game pressing the home button it exits fine. Is only when locking the phone with the app opened.


Solution

  • Try add listeners for the events Event.DEACTIVATE on your main class and Event.EXITING on NativeApplication.nativeApplication.

    On the events handlers you can do what you want to stop / pause your game.

    Add a listener to the event Event.ACTIVATE on the main class to resume the game.