PDA

View Full Version : Sound Control



leuchovius
September 27th, 2002, 09:22 AM
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) ?

frost
September 28th, 2002, 12:26 AM
I have found making a button perform the task easiest - slap an action onto it like this....

on (release) {
stopAllSounds();
}

leuchovius
September 28th, 2002, 03:22 AM
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.

flex
September 28th, 2002, 05:59 AM
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.

leuchovius
September 28th, 2002, 09:46 AM
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?

flex
September 28th, 2002, 09:55 AM
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.

leuchovius
September 28th, 2002, 10:30 AM
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.

flex
September 28th, 2002, 12:14 PM
This happens when you have export in first frame selected in the linkage properties.