stop(); Action Ignored on Nested Movieclip
December 24th, 2009 by
Adrian Parr
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 |
December 24th, 2009 at 3:42 pm
French article about this problem + solution : http://www.ekameleon.net/blog/index.php?post/2008/06/22/AS3-MovieClipplay
December 25th, 2009 at 10:32 pm
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/
January 22nd, 2010 at 3:14 am
thank you for the example files.