May
Hi,
I'm using Actionscript 2.0 I’ve three movieclips on the stage. The first frame in each movieclip has a 'stop();' action so that each movieclip is stopped whent the flash file is played. When each movieclip is clicked they then play (basic movement), and when they’re clicked again they return to their original position.
However, I want it so that one of the movieclips only plays if another has been played, or rather has been clicked once so it is in the second position.
I want to try and do this with a boolean, so the second movie clip will only play, if say Boolean = True.
I'm really green with ActionScript though, and I A) don't know how to declare variables, B) whether I would need them declared globally so they have the ability to be accessed in movieclips and in the main timeline, and C) how to construct an If statement so the movieclip won't play onRelease is the boolean isn't true.
I hope I've been clear enough.
Any help would be enourmously appreciated, many thanks.
Answer:
You declare a global integer, not a boolean:
var lastMovieSeen;
Change the value to be the ID of the last movie clip the person. You change the value in the stop() function for each movie.
function stop() {
lastMoviePlayed = 1; //or whatever movie number this one is
}
In the start() function for each movie, if the value of lastMovieSeen isn’t equal to the number of the motion picture that was supposed to be seen first, you simply don't run the code that starts the motion picture.
function start() {
if(lastMoviePlayed == 1) {
//movie 1 has been seen, go ahead and play this one
}
}
Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList