Skip navigation
AnimatedCircle
Currently Being Moderated

gotoAndPlay() Help.

Apr 13, 2012 4:50 AM

My app works but when it gets to the last part where i want to show the addChild Attack and then when it is complete gotoAndPlay(2) it skips out the addChild Attack and moves onto the next frame..

 

How do i time it so the object movieclip will play and then move onto the next frame..

 

in my movieclip Attack ii just have the coding stop();

 

in the frame 1

 

objectMove.addEventListener(Event.ENTER_FRAME, testHit);

 

 

function testHit(event:Event):void

{

          var Attack:AttackMC = new AttackMC();

 

          if (objectMove.hitTestObject(objectWall))

          {

                    objectMove.removeEventListener(Event.ENTER_FRAME, testHit);

                    addChild(Attack);

                    gotoAndPlay(currentFrame+1);

          }

}

 

thanks.

 
Replies
  • Currently Being Moderated
    Apr 13, 2012 4:54 AM   in reply to AnimatedCircle

    I don't see anything telling your Attack movie to play  (as in (Attack.play(); ).  Is that the one you want to play that you don't see?  Or are you trying to make the main timeline gotoAndPlay the next frame like you show now?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 5:26 AM   in reply to AnimatedCircle

    If you want the Attack to play thru before going to the next frame, then you need to place the gotoAndPlay at the end of the Attack timeline, but it has to target the parent timeline...

     

    MovieClip(parent).gotoAndPlay(MovieClip(parent).currentFrame+1); // in last frame of Attack movieclip

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 5:30 AM   in reply to AnimatedCircle

    You're welcome

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points