AS3 Pitfalls – stop(); Action Ignored on Nested Movieclip
You’ve got a movieclip with a stop action on the first frame. When it appears on-screen, it inexplicably starts playing on frame 2, ignoring frame 1 and your stop action entirely.
The movieclip in question is probably embedded into a parent clip that you’ve dynamically added to the stage from the library using the “new” keyword and “addChild” method.
You’re not going to like this. This bug is one of many we’re discovering as we finally make the painful, money-losing transition from AS2 to AS3 for all our future projects. You have two options:
- Put an extra frame at the beginning of the movieclip, with the stop(); action on frame 2. This solution completely stinks, but welcome to our brave new world where Adobe ignores the needs of designers and caters only to people who code absolutely everything and don’t use the timeline.
- In my case, i was able to stop the clip on frame 1 by making an explicit call from the method that attached the parent clip, like so:
1 2 3 4
var parentClip:MovieClip = new ParentClip(); addChild(parentClip); parentClip.childClip.stop(); // where childClip is the one that's giving us problems
Here are some of the places i hit on my merry way to finding the so-called answer to this problem:
Popularity: 8% [?]