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

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

749

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

Votes

Translate

Translate
Community Expert ,
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

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

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
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?

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
Community Expert ,
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

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

Copy link to clipboard

Copied

It worked!

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

 

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

Copy link to clipboard

Copied

Awesome! You're welcome!

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
Explorer ,
Nov 26, 2023 Nov 26, 2023

Copy link to clipboard

Copied

Screenshot 2023-11-27 154716.pnghi I want to ask you, if I don't use the scene but I use the existing time line. How want to make many songs and he will stop where we want. I made an application that is divided into three parts of learning, quizzes and games

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
Community Expert ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

where are the sound files?  already in animate or being loaded?

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
Explorer ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

is in the adobe library already and i have placed it on the time line below

 

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
Community Expert ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

LATEST

if you're going to use the timeline to start your sounds, the should stream and then place an empty keyframe where the sound should stop.

 

using code offers more control.

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