flash (macromedia):
Navigation buttons restart my sound
How can I prevent this?
I tried asking in the action script forum but nobody there knows what their
doing. So i am asking here hoping somebody knows how set up "on" and "off"
buttons for sound in flash 8 that actually work correctly. I tried several
tutorials and every one is screwed up and does not work right. By themselves
the tutorials are fine. One you put them in a web site you find all the bugs.
Every one I have tried does not keep the sound off when you select it. Every
time I use a navigation button it also re-starts my sound, and depending in the
method I?ve tried it sometimes re-starts the music over the one that?s already
playing. I want an "on" and "off" button that actually works independently of
the rest of the movie, not one that the main navigation also controls the sound.
I want my background music to play when the user arrives, but if they select
off, it should stay off, not restart when I go to the next scene, or page on my
flash site. Does anybody know how to set up sound buttons that actually work
right?
Ok, let?s try this again first I have my two on/off sound buttons in a movie
clip.
You open it up and you see 10 frames the first five for on, and the last five
for off.
Each part contains both buttons, the first the on is highlighted and the off
is coded, the second the off is highlighted and the on is coded.
In the first part my code for the ?off ?button is:
on (release) {
//stopAllSounds Behavior
stopAllSounds();
//Movieclip GotoAndPlay Behavior
this.gotoAndPlay("6");
//End Behavior
}
In the second part my code for the ?on? button is:
on (release) {
// Play Sound Behavior
_global.Behaviors.Sound.coolsound.start(0,1);
// End Play Sound Behavior
//Movieclip GotoAndPlay Behavior
this.gotoAndPlay("1");
//End Behavior
}
I also have an action layer above each with the stop code for each part.
The music loads and plays fine when I run my movie. It stops and starts with
the buttons and they work fine. My problem is whenever I hit a navigation
button on my main timeline it re-starts my music again, instead of it staying
off. Does anybody know why my music restarts and how to stop it from doing so,
unless the user decides to re-start it?
My file is at:
www.designbytreitner.com/main2.fla You can also view it at:
www.designbytreitner.com/main2.html