问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/22368789/ios-air-app-still-running-when-the-iphone-is-locked