Friday, January 8, 2010

How do you use nextFrame(); to go more than one frame in Actionscript 3?

I'm using Flash Cs4 with Actionscript 3, and It would make my coding easier if I could use nextFrame but tell it to go two frames. Can I do that, and if so then how?How do you use nextFrame(); to go more than one frame in Actionscript 3?
You can't.





You have to use gotoAndStop() or gotoAndPlay() like this:





gotoAndStop(getCurrentFrame()+%26lt;number of frames to jump%26gt;);





i.e.


If I'm on frame 5 and I want to go to frame 10:


gotoAndStop(getCurrentFrame()+5);





N.B. Replace Stop with Play if you want your animation to continue playing after moving to the other frame.

No comments:

Post a Comment