Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-21-2005, 05:15 PM   #1
cricket5
Registered User
 
Join Date: Jul 2005
Location: michigan
Posts: 5
Default 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!
cricket5 is offline   Reply With Quote
Old 09-21-2005, 05:32 PM   #2
lelales
forever learning
 
lelales's Avatar
 
Join Date: Aug 2004
Location: New Olreans
Posts: 1,261
Send a message via AIM to lelales Send a message via Yahoo to lelales
Default don't use scenes

I only say "don't use scenes" because I have seen people smarter than me say the exact same thing. Either place all scenes on one timeline and use frame labels, or load separate swf's for each scene.

I hope this solves your problem
lelales is offline   Reply With Quote
Old 09-21-2005, 11:44 PM   #3
cricket5
Registered User
 
Join Date: Jul 2005
Location: michigan
Posts: 5
Default

For ease of design, scenes need to be used in this project. There's got to be a way to make this work. Why would Macromedia put scenes in Flash if they are not good to use?
cricket5 is offline   Reply With Quote
Old 09-22-2005, 12:04 AM   #4
lelales
forever learning
 
lelales's Avatar
 
Join Date: Aug 2004
Location: New Olreans
Posts: 1,261
Send a message via AIM to lelales Send a message via Yahoo to lelales
Default if you use scenes . . .

I recently updated a site for United Way and they used scenes effectively, yet I did not understand how they made the sound work.

The sound was loaded into a separate swf then loaded into the movie. I haven't tried to execute a sound or music file over several scenes but it should be possible.

that's all I know.
lelales is offline   Reply With Quote
Old 09-22-2005, 02:39 AM   #5
cricket5
Registered User
 
Join Date: Jul 2005
Location: michigan
Posts: 5
Default

yeah, mine is set up so that the music is loaded into an external swf. The music loads and unloads correctly. But when going to another scene the music control button resets to the "on" position, even though the music is still off.
I have tried the variables listed above as well as putting the sound control button in the same movie as the music and it still does the same thing. Weird.
Are my variables set up incorrectly?
cricket5 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:39 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.