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

Stop all sounds as3? Help

Community Beginner ,
Oct 20, 2013 Oct 20, 2013

When the game starts. I have toggle button. I can play a sound or stop sound. When i play the sound, of course its not muted so even if i go to the next page. I can reason out that the sounds will still play.

But if i press the no sound,so it means it must be muted.. on the first screen, the sound stops. But when I go the next frames and to others. The sounds are playing. The sound on the starting screen

was like

var test:Sound = new NameOfSound();

but in the next frames.. the sound is in the frame itself.. no declaring like the first screen..

and also some sounds is playing when something happens or for example if the bullet hits the target collsion..sound play..

i tried to have solution like on the first screen if for example it is muted.. ill set it to trueStop.. then on the next frames.. i would put:

if(trueStop == true){

     SoundMixer.stopAll();

}

that way the frame sounds stopped and working.. but the sounds attach to the function when like i said if a collision happens,, the sound is still playing.. arrgghh i cant explain clearly.. i hope you understand my problem..

any ideas?

TOPICS
ActionScript
2.6K
Translate
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 , Oct 21, 2013 Oct 21, 2013

if you need to stop individual sounds, assign a soundchannel to the instance returned by your play method and apply a stop method to that soundchannel.

for example:

var s1:Sound=new S1();

var sc1:SoundChannel=s1.play();

// now at any time you can use:

sc1.stop();  // to stop s1 only.

Translate
Community Expert ,
Oct 21, 2013 Oct 21, 2013

if you need to stop individual sounds, assign a soundchannel to the instance returned by your play method and apply a stop method to that soundchannel.

for example:

var s1:Sound=new S1();

var sc1:SoundChannel=s1.play();

// now at any time you can use:

sc1.stop();  // to stop s1 only.

Translate
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 ,
Oct 21, 2013 Oct 21, 2013

i have 10 sounds .. do i have to make 10 of sound channels? cause im just using the sound channel on the starting screen..

Translate
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 ,
Oct 21, 2013 Oct 21, 2013
LATEST

yes.

if you want to control each sound independently of the others, create an unique soundchannel instance for each:

Translate
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