# Flash Movie - How to Create a MUTE button?

**URL:** https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502
**Category:** flash
**Created:** [September 16, 2004, 11:24pm UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502 "2004-09-16T23:24:56Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![teresam](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@teresam](https://forum.kirupa.com/u/teresam)
#### Post date: [September 16, 2004, 11:24pm UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/1 "2004-09-16T23:24:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 17, 2004, 1:01am UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/2 "2004-09-17T01:01:45Z")

</div>

[Click here](http://www.kirupaforum.com/forums/showthread.php?t=60244&highlight=mute+button)  
I think this is what you’re looking for.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 17, 2004, 6:19am UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/3 "2004-09-17T06:19:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 17, 2004, 10:26am UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/4 "2004-09-17T10:26:12Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 17, 2004, 4:47pm UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/5 "2004-09-17T16:47:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 20, 2004, 5:32pm UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/6 "2004-09-20T17:32:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 20, 2004, 8:57pm UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/7 "2004-09-20T20:57:58Z")

</div>

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

```auto

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

```

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

```auto

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 20, 2004, 9:02pm UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/8 "2004-09-20T21:02:33Z")

</div>

And for your replay button, just use…

```auto

mySound.start();

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 20, 2004, 10:51pm UTC](https://forum.kirupa.com/t/flash-movie-how-to-create-a-mute-button/64502/9 "2004-09-20T22:51:40Z")

</div>

## 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](https://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); }
