# How to make a button for sound on /off?

**URL:** https://forum.kirupa.com/t/how-to-make-a-button-for-sound-on-off/2156
**Category:** flash
**Created:** [May 18, 2002, 6:34pm UTC](https://forum.kirupa.com/t/how-to-make-a-button-for-sound-on-off/2156 "2002-05-18T18:34:25Z")
**Posts on this page:** 2
**Page:** 1

<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: [May 18, 2002, 6:34pm UTC](https://forum.kirupa.com/t/how-to-make-a-button-for-sound-on-off/2156/1 "2002-05-18T18:34:25Z")

</div>

How do I make a button for sound on/off? (I’m a beginner,so please take it easy!..)  
Thanks all!  
[marcelo7070@yahoo.com](mailto:marcelo7070@yahoo.com)

---

<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: [May 18, 2002, 10:40pm UTC](https://forum.kirupa.com/t/how-to-make-a-button-for-sound-on-off/2156/2 "2002-05-18T22:40:57Z")

</div>

You need to insert a movie clip & then draw your on/off button inside of it. Once draw press insert, then convert to symbol & choose button. Add this script to the button:

on (press) {  
if (\_root.condition == true) {  
stopAllSounds ();  
\_root.condition = false  
}else{  
gotoAndPlay or loadMovieNum //location where your sound is  
\_root.condition = true  
}  
}

That should it it for you. O 1 other thing please initialize the variable by adding this action:  
\_root.condition = true  
to frame 1
