• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

gotoAndPlay() Help.

Community Beginner ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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.

TOPICS
ActionScript

Views

763

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 13, 2012 Apr 13, 2012

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

Votes

Translate

Translate
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

ii want the attack to play so ii put

addChild(Attack);

and then once it plays in full ii want to move to next frame.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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);

                    Attack.play();

                    gotoAndPlay(currentFrame+1);

          }

}

ii put that in instead and it still misses the attack object movieclip out and just continues to the next frame.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

Thank You So Much It Worked

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

LATEST

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines