stop(); Action Ignored on Nested Movieclip

December 24th, 2009 by Adrian

Recently I stumbled across this post by Ryan Creighton at Untold Entertainment from back in October 2008 titled ‘stop(); Action Ignored on Nested Movieclip‘. It basically demonstrates how (in AS3) a child movieclip does not stop on the first frame (even though you have put a stop(); action on it) when it’s parent/container is dynamically attached to the stage.

To me this does seem like a bug. Unless I am missing some subtle difference in this area between AS2 and AS3 that I am missing. If so, please can someone explain it to me?

I’ve knocked up a couple of examples to demonstrate …

Firstly, here is the AS2 version that attaches the container movieclip to the stage using the old attachMovie method. Sure enough, the child movieclip does as it is told and stays on frame 1.

And here is the AS3 version that instantiates the Contaner class and adds it to the display list using addChild. As you can see the child movieclip ignores the stop() command on frame 1 and goes to frame 2 instead. Why?

You can download a ZIP file containing the source files for these two examples here.

More discussion about this issue can be found on actionscript.org, but no-one really explains why this is happening. Any ideas?

Posted in ActionScript 3.0, Bug, Sample Code | 3 Comments »

3 Responses

  1. ekameleon Says:

    French article about this problem + solution : http://www.ekameleon.net/blog/index.php?post/2008/06/22/AS3-MovieClipplay

  2. Alan Says:

    I’m failry certain that this to do with how the Flash rendering model works. There is a difference between when objects are avaible and when code is executed.

    It’s more about when display objects are rendered/created and are available for maipulation.

    http://tv.adobe.com/watch/max-2009-develop/flash-player-internals/

    http://www.craftymind.com/2008/04/18/updated-elastic-racetrack-for-flash-9-and-avm2/

  3. sharedtut Says:

    thank you for the example files.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.