Saturday, January 16, 2010

AS3 question about controlling a dynamic child movieclip?

sorry, I couldn't find a very simple answer on any as3 forums so I went here...





I add a child to the stage through code, I want to gotoAndStop at a certain frame within that child's timeline. how do I reference that child?





and why does this work:


getChildAt(0).y = 1;





but this doesn't:


getChildAt(0).gotoAndStop(4);AS3 question about controlling a dynamic child movieclip?
so u've exported the MovieClip for actionscript given it a Class name.





Use this code:


//declare a new variable to create ur movieClip


var myMovieClip:MovieClip = new MovieClip();


//add Child to the display list


stage.addChild(myMovieClip);


//to control the movieClip, type a period followed by Method/property


myMovieClip.gotoAndStop(4);





That should work, if the main timeline is stopped on that frame as well.





Goodlucl..

No comments:

Post a Comment