# Sound button START/STOP

**URL:** https://forum.kirupa.com/t/sound-button-start-stop/288893
**Category:** flash
**Created:** [May 22, 2009, 1:30pm UTC](https://forum.kirupa.com/t/sound-button-start-stop/288893 "2009-05-22T13:30:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Terry\_elekes](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@Terry\_elekes](https://forum.kirupa.com/u/Terry_elekes)
#### Post date: [May 22, 2009, 1:30pm UTC](https://forum.kirupa.com/t/sound-button-start-stop/288893/1 "2009-05-22T13:30:02Z")

</div>

I am trying to make a button that will start the sound on one click and then stop it if you click again. When I check the code for errors in the action panel it says that there is no error but when I test the movie 2 error messages come up. Could use some help to fix. New to AS3

play\_mc.addEventListener(MouseEvent.CLICK , playSong);

function playSong(MouseEvent):void {  
var music:Number = 0;  
var song:Sound = new conna();  
var pausePos:Number = song.position;  
if (music!=1) {  
if (pausePos==0) {  
pausePos=1;  
song.play();  
music=0;  
}

```
} else {
	if (music==0) {
		pausePos=pausePos/1000;
		song.stopAll();
		music=1;
	}
}

```

}
