Hey all,
I’ve recently come across what I think is a legitimate bug in the behaviour of gotoAndPlay in AS3 (using flash CS3), and I’m astounded I hadn’t found it sooner. Please don’t write this “bug” off as an artefact of beginner code yet, I’ve been using flash for a good many years.
In previous versions of actionscript, if you tell a movieclip to gotoAndPlay a certain frame, it will display the given frame next step and continue to play normally from there. Simple.
Imagine a movieclip has 20 frames, and before frame 5 is displayed you tell it to gotoAndPlay(10) a simple trace of currentframe on enterframe will return this: 1, 2, 3, 4, 10, 11, 12, 13, 14…
But if you do the same test in AS3,** it pauses for one step after sending the playhead to the designated frame.** So the same test as before will return this: 1, 2, 3, 4, 10, 10, 11, 12, 13, 14… it sits on frame 10 for an extra step.
See attached files for examples, the frame rate is only 4fps so the extra frame pause is much more noticeable. It also has the same 1-frame-pause if you gotoAndStop on a frame that contains a movieclip (test2). And changing back to AS2 before exporting rids the problem.
I guess some people may say ‘its only one frame, it shouldn’t matter’, but one frame can make a massive difference when dealing with the look of animations. And I could just write my own enterframe listener to advance by a frame every step. But the point is I don’t think that flash shouldn’t behave like this, regardless of what workarounds are available.
The only other place I could find that have acknowledged this is here: http://www.actionscript.org/forums/showthread.php3?t=153733
So, does anybody know what causes it? Why it does it? What is the best workaround? Can it be fixed entirely? And does this happen in CS4? I haven’t got CS4 to test it on. Thankyou.