Answered
Want To Stop Every Music In Background When Minimized In SWF or APK
I Have a Little Trouble When i Realise The Music Background Wont Stop When I go Minimized this app, anyone know to mute sound when minimized ?
I Have a Little Trouble When i Realise The Music Background Wont Stop When I go Minimized this app, anyone know to mute sound when minimized ?
Hi.
You'll need to listen for the ACTIVATE and DEACTIVATE events from the NativeApplication class. Like this:
import flash.desktop.NativeApplication;
import flash.events.Event;
import flash.media.SoundMixer;
function deactivateHandler(e:Event):void
{
// stop/mute/pause sounds
// e.g.: SoundMixer.stopAll();
}
function activateHandler(e:Event):void
{
// play/resume sounds
// e.g.: yourSound.play();
}
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, deactivateHandler);
NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, activateHandler);
I hope this helps.
Regards,
JC
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.