# Hello all, can someone help me with making an on/off button --\>\>

**URL:** https://forum.kirupa.com/t/hello-all-can-someone-help-me-with-making-an-on-off-button/10680
**Category:** flash
**Created:** [January 5, 2003, 4:02pm UTC](https://forum.kirupa.com/t/hello-all-can-someone-help-me-with-making-an-on-off-button/10680 "2003-01-05T16:02:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![NeoSwords](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@NeoSwords](https://forum.kirupa.com/u/NeoSwords)
#### Post date: [January 5, 2003, 4:02pm UTC](https://forum.kirupa.com/t/hello-all-can-someone-help-me-with-making-an-on-off-button/10680/1 "2003-01-05T16:02:44Z")

</div>

I’m trying to create an on/off button using only one button (instead of 2 separate buttons); meaning when the user presses the button when the music is on, the music turns off & vice versa…

is there a code/coding that will enable me to perform this task?

I thank everyone for all their help 🙂

---

<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: [January 5, 2003, 5:03pm UTC](https://forum.kirupa.com/t/hello-all-can-someone-help-me-with-making-an-on-off-button/10680/2 "2003-01-05T17:03:22Z")

</div>

piece a cake! Use [[this]](http://www.kirupa.com/developer/actionscript/sound.asp) tute for the music play&stop actions and the followong code to mkae it a toggle button!

on(release) {  
if(!music) {  
\<music play actions\>  
} else {  
\<music stop actions\>  
}
