# (F5) sound scripting help

**URL:** <https://forum.kirupa.com/t/f5-sound-scripting-help/11316>\
**Category:** flash\
**Created:** [January 15, 2003, 1:29pm UTC](https://forum.kirupa.com/t/f5-sound-scripting-help/11316 "2003-01-15T13:29:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToddziLLa](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@ToddziLLa](https://forum.kirupa.com/u/ToddziLLa)\
**Post date:** [January 15, 2003, 1:29pm UTC](https://forum.kirupa.com/t/f5-sound-scripting-help/11316/1 "2003-01-15T13:29:22Z")

</div>

OK, I have 4 loops in my movie. I have a button that I want to change between those loops, as well as a button that mutes and unmutes the sounds. I have a script for both, but neither of them work at all. What’s wrong?

Here’s the script for the changing button (by the way, my sounds are linked by sound1, sound2, sound, and sound4);

on (press) {  
\_root.number=\_root.number+1;  
if (\_root.number==4) {  
\_root.number = 1;  
trace (\_root.number);  
}  
\_root.Sound.loop.stop();  
\_root.Sound.loop.attachSound(“sound”+\_root.number);  
\_root.Sound.loop.start(0, 999);  
}

And here is my code for the mute/unmute button;

on(release)  
{  
\_root.muted = \_root.muted  
if(\_root.muted) \_root.Sound.loop.setVolume(0)  
else \_root.sound.loop.setVolume(100)  
}

Neither of them work, can someone post scripts that will work? 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:** [January 15, 2003, 3:52pm UTC](https://forum.kirupa.com/t/f5-sound-scripting-help/11316/2 "2003-01-15T15:52:37Z")

</div>

Hi Toddzilla,

PREVIOUS/NEXT BUTTON  
Try reading through this. Be patient on page coming up.

[http://www.flashkit.com/board/showthread.php?threadid=299918](http://www.flashkit.com/board/showthread.php?threadid=299918)

Specifically FAQ#6 for Next/Previous Buttons. Arrays are the way to go.

MUTE/UNMUTE BUTTON  
Make a mc with two buttons inside it. Make an actions layer, layer for button 1 and layer for button2. On actions layer put a stop(); frame command on frame 1 and frame 2. On frame 1 have the play button. On frame 2 have the mute button.

play button code

```auto

on(release){
    this._parent.gotoAndStop(2); //move to frame where mute button is
    _root.Sound.loop.start(0, 999); //check your path for your sound object

```

mute button code

```auto

on(release){
    this._parent.gotoAndStop(1); //move to frame where play button is
    _root.Sound.loop.stop(); //check your path for your sound object

```

Try to create your Sound object in the 1st frame of your \_root timeline and have your buttons refer back to that sound object
