Background music doesn't stop in scene 2

Community Beginner ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

I'm having a problem with the audio on Adobe Animate, I have a project with multiple scenes, I want to add background music to each scene but the problem is the music from scene 1 doesn't stop when I go to scene 2 & 3, or even when I go back to scene 1, they all get mixed together.
So how do I make the music play just for a specific scene and stops for another music to play in another scene?
Thanks

TOPICS
ActionScript , Code , How to , Timeline

Views

83

Likes

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

Adobe Community Professional , Apr 29, 2022 Apr 29, 2022
Please make sure that the sound sync property is set to Event and that you are calling SoundMixer.stopAll(); before moving to another scene. Here is an example: https://bit.ly/3rZKAj9 AS3 code: Scene 1 import flash.events.MouseEvent; import flash.media.SoundMixer; function gotoScene1(e:MouseEvent):void { SoundMixer.stopAll(); gotoAndStop(1, "Scene 1"); } function gotoScene2(e:MouseEvent):void { SoundMixer.stopAll(); gotoAndStop(1, "Scene 2"); } function gotoScene3(e:MouseEvent):void {...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

Hi.

 

If you only have just one sound playing in each scene, an easy workaround is to run SoundMixer.stopAll(); before entering a new scene.

 

Please let us know if this works for you.

 

Regards,

JC

Likes

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
Community Beginner ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

Thanks for replying 

This solution stops all music in every single scene, including the first scene when I go back to it, so when I jump to scene 2 or back to scene 1 there's no music anymore.

I'm trying to make a game for children and each scene is a level so I want to give each level a different background music.

Likes

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
Community Beginner ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

So yeah is there a way to make scene 1 music play only on scene 1, scene 2 music play only on scene 2, etc automatically without having to click on a button that stops music?

Likes

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
Adobe Community Professional ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

Please make sure that the sound sync property is set to Event and that you are calling SoundMixer.stopAll(); before moving to another scene.

 

Here is an example:

https://bit.ly/3rZKAj9

 

AS3 code:

Scene 1

import flash.events.MouseEvent;
import flash.media.SoundMixer;

function gotoScene1(e:MouseEvent):void
{
	SoundMixer.stopAll();
	gotoAndStop(1, "Scene 1");
}

function gotoScene2(e:MouseEvent):void
{
	SoundMixer.stopAll();
	gotoAndStop(1, "Scene 2");
}

function gotoScene3(e:MouseEvent):void
{
	SoundMixer.stopAll();
	gotoAndStop(1, "Scene 3");
}

stop();
scene1Button.mouseEnabled = false;
scene2Button.addEventListener(MouseEvent.CLICK, gotoScene2);
scene3Button.addEventListener(MouseEvent.CLICK, gotoScene3);

 

Scene 2

import flash.events.MouseEvent;

scene1Button.addEventListener(MouseEvent.CLICK, gotoScene1);
scene2Button.mouseEnabled = false;
scene3Button.addEventListener(MouseEvent.CLICK, gotoScene3);

 

Scene 3

import flash.events.MouseEvent;

scene1Button.addEventListener(MouseEvent.CLICK, gotoScene1);
scene2Button.addEventListener(MouseEvent.CLICK, gotoScene2);
scene3Button.mouseEnabled = false;

 

I hope it helps.

 

Regards,

JC

Likes

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
Community Beginner ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

It worked!

Thank you so much, you saved my school project ❤️

 

Likes

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
Adobe Community Professional ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

LATEST

Awesome! You're welcome!

Likes

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