-
Stuck on Code, please help!!
Hey guys,
Im having a problem trying to keep a loaded level from reloading and playing over. I have a looped region in my main movie, within this looped region, i have a event that loads a level, _level1 to be exact. The problem is everytime it loops, the event repeats and reloads _level1, then the level1 movie replays, anyone know of a solution?
-
you can set up a variable that says something like :
moviePlaying = false;
then on the part where it is loading the movie in, use an if statement, something like:
if(moviePlaying = false);{
loadMovie(yourMovie, clipHolder);
moviePlaying = true;
}
tank.
if i buy duct tape, the terrorists win..
-
Monkey Moderator
sorry to correct you, but there was a slight error
the solution is reasonable though.
Code:
if(moviePlaying == false){
loadMovie(yourMovie, clipHolder);
moviePlaying = true;
}
// can also be written as
if(!moviePlaying){
loadMovie(yourMovie, clipHolder);
moviePlaying = true;
}
www.lexicon-design.co.uk
If we aren't supposed to eat animals, then why are they made of meat?
If Vegetarians like animals so much, why do they eat all their food?
-
yes, thanks for the correction...
oh and by the way, if we were meant to eat meat, how come our teeth are so much smaller than that of a carnivorous animal?
tank.
if i buy duct tape, the terrorists win..
-
can you explain the logic on the code above? I put the following code in my main movie, when it loops, the newslider.swf is still reloading evertime
if(moviePlaying == false){
loadMovie("newslider.swf", clipHolder);
moviePlaying = true;
Thanks in advanced
Last edited by dna_hard; 07-14-2004 at 10:08 PM.
-
if(moviePlaying == false){
loadMovie("newslider.swf", clipHolder);
moviePlaying = true;
what this is doing is when it gets to that spot on the timeline where the above script is triggered, it checks to see if the movie is playing...since we established the variable 'moviePlaying' with a value of 'false', once we hit the frame where the above script is triggered the movie designated will load, and then we set the 'moviePlaying' variable to equal 'true' so that the next time the above script is triggered, 'moviePlaying' will not equal 'false' and thus will not trigger the statement above.
the reason that your movie may still be playing is if you are looping back to the frame where you establish 'moviePlaying' as 'false'...you should have your movie loop to a place later in the movie after where you establish moviePlaying as false...
good luck
tank.
if i buy duct tape, the terrorists win..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|