Sound Control

Is there a way to mute all sounds in a whole scene?
I want to have a button that turns off all sounds and stops
all sounds from playing until i press the button again.
The button is done and there’s a "set(gallerysound,1)
instruction in it when first pressed, and then it
changes to zero the second time around. But now I’m stuck.

How do i use this var to control the sounds in other keyframes?
(preventing the sounds from playing until gallerysound changes again) ?

I have found making a button perform the task easiest - slap an action onto it like this…

on (release) {
stopAllSounds();
}

I want the button to work as a “mute” button does on a TV. While it’s in mute mode, no sound should start, but when you unmute it, sounds should be allowed again.

i have 7 keyframes, one soundclip plays in each,
and there’s a navigation system which lets the user
navigate through the frames.

stopAllSounds works, but then you have to
push it every time you move to a new frame.

Use a variable.

In your actions layer, set up the sounds

sound1 = new Sound();
sound1.attachSound("linkagename");

To set the linkage name go to your library right click on the sound, then properties and give the linkage name.

On the button

on (release) {
soundsoff = 1;
}

then every keyframe where there is new sound use:

if (!soundsoff){
_root.bonsound.start();
}

The sound shouldn’t start because the soundsoff variable is 1 or true.

Then on the sounds on button use:

on (release) {
soundsoff = 0
}

It’s only going to check everytime it comes across a command to play a sound, so it’s not a dynamic on off system.

This seems to be a good solution, but I’m having problems with the variable, how do I declare it? Does it have to be global?
And if, how do I declare a global variable?

You can define soundoff, in a frame in the main timeline and refer to it as _root.soundoff on the buttons and checks.

Global variables are declared using “set”. The above should work for you.

It works now, but now the problem is how and when to load the sounds… I can’t load all sounds into the first frame, because it gets a size above 200k. and if i don’t load it into the first frame, the sounds don’t play when i want them to.

This happens when you have export in first frame selected in the linkage properties.