• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Want To Stop Every Music In Background When Minimized In SWF or APK

New Here ,
Jun 01, 2023 Jun 01, 2023

Copy link to clipboard

Copied

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 ?

Views

80

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 02, 2023 Jun 02, 2023

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, deactivateHandle
...

Votes

Translate

Translate
Community Expert ,
Jun 02, 2023 Jun 02, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines