sound on/off variable
Hi,
I hope I can explain this in a non-complicated way...
I am creating a Flash projector. I am having music loaded into it from an external swf in another layer. I have set up a movie that contain buttons in an on and off state to load/unload the music swf file. When the music is playing, the sound button is in the on state and displays an animation indicating that it is on. When it is off, there is no animation. This sound control movie is nested within another movie.
The projector file has several scenes in it. I have set up a varible called "music".
var music;
What needs to happen is when the sound button is turned off the variable is set to "musicoff". When turned on the variable is set to "musicon".
The on state button is programmed like so:
ON STATE:
on (release) {
music = "musicoff";
gotoAndPlay("off");
}
OFF STATE:
on (release) {
music = "musicon";
loadMovieNum("music-soft.swf", 5);
gotoAndStop("on");
}
At the beginning of each scene in the projector file I have the following code:
if (music == "musicoff") {
this.silver.musicbutton.gotoAndPlay("musicend");
} else if (music == "musicon") {
this.silver.musicbutton.gotoAndPlay("on");
}
Where "musicbutton" is a movie nested within the movie "silver". "musicend" is the last frame in the off button state.
The problem I'm having is that if the music is not playing I want the musicbutton to go to the "off" state. If I click the button and stay in that scene everything looks as it should. However, if I go to another scene in my projector the button returns to the "on" state (though the music is not reloaded until the button is pressed).
I'm not sure if the variable is not being set, or if that actionscript is not telling the musicbutton to go to the off state, or what?
I hope this is not too confusing.
Does anyone have any ideas about this?
Thanks!
|