In your init function, try adding:
addEventListener(Event.ACTIVATE, this.onActivate);
addEventListener(Event.DEACTIVATE, this.onDeactivate);
Then you can try pasuing/playing the music in the onActivate and onDeactivate functions.
In your init function, try adding:
addEventListener(Event.ACTIVATE, this.onActivate);
addEventListener(Event.DEACTIVATE, this.onDeactivate);
Then you can try pasuing/playing the music in the onActivate and onDeactivate functions.
Thanks! After researching your advice, I ended up with this:
this.stage.addEventListener(flash.events.Event.ACTIVATE, onResume, false, 0, true); this.stage.addEventListener(flash.events.Event.DEACTIVATE, onPause, false, 0, true);
in my init, and then:
private function onPause(event:flash.events.Event):void
{
SoundMixer.stopAll();
}
private function onResume(event:flash.events.Event):void
{
FP.world = new MenuWorld();
}
Which suits me perfectly! Normally you would save the game state in pause and then resume it in resume, but my game doesnât really need that (youâll want to start again on resuming), so this simpler approach suits me fine.
And with that, Iâm ready to launch the game. Thanks to everyone who helped in this thread! It was quite a bit of fun working it all out.
My games THOSE DARN NIPPLES and GROIN GRAVITATORS are now on OUYA!
Here are a few extra tips for getting a game on OUYA.
Youâll need a 732x412 icon. Just dump it in the icons/android folder and add an extra line to the application.xml specifying the new icon size and location.
In the application.xml, there will be a manifest additions section. In it, youâll need to add:
air.MyGame
Trust me, it will save you a lot of trouble.