Copy link to clipboard
Copied
I am dynamically creating my content by adding content from the library as follows:
var newBall = new lib.ball();
this.addChild(newBall);
The ball movie clip is added to the stage with the above code.
My ball movie clip has 4 keyframes, each of which is a different ball graphic.
I would like to set the keyframe after adding the ball to the "stage" and have tried the following:
newBall.gotoAndStop(2);
This has no effect.
I am assuming the issue is that the ball has not been instantiated yet so I would like to know how to check the ball has been instantiated before calling the gotoAndPlay code? I was thinking I could call it after a small delay but I would prefer a more robust solution.
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now