-
gotoAndStop not working
Hi
I have what will probably amount to a very small problem: I can't seem to get flash to stop repeating itself with the gotoAndStop function.
I have 4 frames: on frame 1, I have a button generating a random number from 2 to 4 (only 3 frames, I know). once hit, the button generates the random number and moves to said frame. No problems until the animation on the frame just endlessly loops.
I've got stop(); on each of the 3 frames in question, I'm using the gotoAndStop command in frame 1 when calling the random frame into play. I'm a total n00b with Flash and AS, and I'm sorry if this is a really daft question, but how do I get it to stop once the movieclip has played?
Thanks in advance
-
So you have a movieclip on each frame? and when you get to one of those frames the animation inside that movieclip is repeatedly begin played? Just add a stop() at the end of the animation inside that movieclip then.
-
thanks for the reply Geneve, I'm trying it as I type... and you are amazing!!! I didn't think to go into the movieclip and THEN add the stop at the last frame of the actual clip. Duh!
Once again, thank you so much for the help
-
-
Alternately you could have checked from -outside- the MovieClip to see if it was finished playing:
Code:
// AS2 syntax
if (MC1._currentframe == MC1._totalframes) {
MC1.stop();
}
...but at least you fixed your problem.
-
that code is logically correct, but for me sometimes it wouldn't fire, as if, a frame has been skipped(enterFrame event)....and hence I personally prefer the option of manually putting the stop() on the last frame.
-
I commented on the fact that it's AS2 syntax. I've pretty much forgotten how basic AS2 works. :/
-
thanks for the replies guys, I've taken the "easy" way out and just added stop() to the end of each movieclip (I only have 6) and it works a treat.