Flash Movie - How to Create a MUTE button?

I created a flash movie with sound. I know how to create a button symbol i just dont know how to code a MUTE button.

I want the user to have the option of turning on the music or off the music when they enter my website. Can someone please help me on this one.

Thanks.

Click here
I think this is what you’re looking for.

Mute is sound volume equal zero.

thus … we use object to help

mysound.setVolume (0) ;

If u have any problem after try to do it
I’ll come to help u again ^^

This may be a different technique, but it has worked for me…
I prefer to put the sound file in an empty .swf (just sound) - this allows me to preload it.
When I want to “mute”, I just unload the sound.swf

If you just set sound.volume to 0, this means the sound will continue to play, it just happens that you can´t hear it (thus consuming system resources).

Just a different approach!

OK this code…

—> mysound.setVolume (0) ; WORKS!

But if mute = 0 then what is the maximum volume for sound. I want the option to play the music as well. (unmute button)

THanks.

So does anyone know how to create a UNMUTE button?

Basically, the is my scenerio…

When the user loads the page, the music already starts to play. As soon as they press the MUTE button, there will be no sound. BUT when the user presses the REPLAY button, i want the music to start up again.

How would i go about coding the REPLAY button to play the music??

OK, when the mute button is pressed, use this code…


currentVolume = mysound.getVolume();
mysound.setVolume(0);

And when the unmute button is pressed, use this code…


mySound.setVolume(currentVolume);

By the way, the volume in Flash is a 0-100 scale so zero is muted and full volume is 100.

Dave

And for your replay button, just use…


mySound.start();

Ok im having multiple heartattacks. I cant get it to work. I tried switching my mute button to be similar to the one u suggested but it doesnt work. Here ill paste the code im using. and the comments is the code that does work.
BG = the name of my background music.

on(release){
currentVolume = bg.getVolume();
bg.setVolume(0);

//globalSound = new Sound();
//globalSound.setVolume(0);
}

And in the replay button here is the code, that im trying to set the volume back up at 100.

on (release) {
gotoAndPlay(2);
bg.setVolume(100);
}