(F5) sound scripting help

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.

Hi Toddzilla,

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

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


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


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