PDA

View Full Version : If Statements?



LaVae
March 15th, 2005, 12:44 AM
Hello All....

Is there a way to:

From a button, check what swf file is loaded into _level1 and then tell it to gotoAndPlay frame #

I have a feeling I need to use if and else, but I am not sure how to go about it.

Any help would be appreciated.

Danno
March 15th, 2005, 05:10 AM
when loading that movie onto the stage, if loading it into a blank movie clip, you can go about it a couple ways:

1. in the movie that has been loaded into empty clip at the _root level, have it declare in its first frame a variable value.



_root.movieLoaded = movieOne;

2. If you are loading the swf file into that empty movie clip on the stage by a button, declare that variable at that time



on(release){
_root.movieLoaded = movieOne;
}

Now that you have that declared, you can have your IF and ELSE statments. this wont be the cleanest , but it'll get you started on your path:



on(release){
if (_root.movieLoaded == movieOne){
trace ("movieOne!");
gotoAndPlay(frameHere);
} else if (_root.movieLoaded == movieTwo){
trace ("movieTwo!");
gotoAndPlay(frameHere);
} else if (_root.movieLoaded == movieThree){
trace ("movieThree!");
gotoAndPlay(frameHere);
} else if (_root.movieLoaded == movieFour){
trace ("movieFour!");
gotoAndPlay(frameHere);
}
}


Hope that helps.

Danno~