# Multiple toggle buttons to control (on/off) music.swf

**URL:** https://forum.kirupa.com/t/multiple-toggle-buttons-to-control-on-off-music-swf/61038
**Category:** flash
**Created:** [August 15, 2004, 5:46am UTC](https://forum.kirupa.com/t/multiple-toggle-buttons-to-control-on-off-music-swf/61038 "2004-08-15T05:46:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![zac](https://avatars.discourse-cdn.com/v4/letter/z/87869e/32.png) [@zac](https://forum.kirupa.com/u/zac)
#### Post date: [August 15, 2004, 5:46am UTC](https://forum.kirupa.com/t/multiple-toggle-buttons-to-control-on-off-music-swf/61038/1 "2004-08-15T05:46:01Z")

</div>

Hi,

I have a little t.v. set on my homepage: [www.folkphotography.com](http://www.folkphotography.com/) that has 4 buttons that I want to control different sound files. I want each button to turn on a loop with first click and shut it off with a second click. If you test what I have now only one button works… and not very well. Any ideas on how I should do this. I had an idea of putting the slide show into a movie clip and having the sounds on different parts of the main timeline. SO far I tried it with actionscript which I really dont understand and had a ton of help just coming up with this:

```auto
on (release) {
 
this.sndbtn.onRelease = function(){
		count++;
		if (count % 2) {_level5.stop();}
		else{_level5.play();}}}

```

and in the frame:

```auto
this.onLoad = function () {
loadMovieNum("music.swf",5);
}

```

I tried to make another swf and button and loading it too level 6 with the code otherwise the same… that didn’t work. Any help, advice, or links that you can offer would be really appreciated.

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: [August 16, 2004, 6:14am UTC](https://forum.kirupa.com/t/multiple-toggle-buttons-to-control-on-off-music-swf/61038/2 "2004-08-16T06:14:24Z")

</div>

According to the button code, you are telling a movie clip to stop and play. You should try using the sound object and not the timeline to control sound.  
create the object like this:  
obSound = new Sound(\_level5);

then start and stop it like this:  
this.sndbtn.onRelease = function (){  
count++;  
if (count%2){  
obSound.stop();  
} else {  
obSound.start();  
}  
};

Hope that helps,  
🙂  
Jeremy
