0 Replies Latest reply on Nov 8, 2016 7:25 AM by P Steven

    gotoAndPlay not working adding library item using new lib.xxxx

    P Steven Level 1

      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.