Search code examples
iphoneiosactionscript-3air

AIR app still running when the iphone is blocked?


I just made a simple game with flash professional 6.0 and adobe AIR sdk 3.4 for iPhone.

The problem is this: 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.

Also, I opted-out of multitasking for my app, so if I close my app with the home button and I reload it, it loads the main menu.

Anyone knows how can I solve this?


Solution

  • Ok, after a lot of reading, it is a very very simple solution, just with this at the start of the app:

    SoundMixer.audioPlaybackMode  =  AudioPlaybackMode.AMBIENT;
    

    With this playback mode, the sound mutes when the app goes to the background.