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

How to stop the animation at a certain frame?

New Here ,
May 01, 2010 May 01, 2010

Well, as the title already says, how can I stop my animtation at a certain frame. Is it only possible due setting up a timer, or can I also enter a code that stops at a certain frame?

And when I stop the animation, will my buttons still be able to get clicked?

Greetings,

Coyke

TOPICS
ActionScript
8.2K
Translate
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 , May 01, 2010 May 01, 2010

Well, as the title already says, how can I stop my animtation at a certain frame. Is it only possible due setting up a timer, or can I also enter a code that stops at a certain frame?

Here is what need to do in general:

addEventListener(Event.ENTER_FRAME, onEnterFrame);

function onEnterFrame(e:Event):void {
     if (currentFrame == 200) stop();
}

And when I stop the animation, will my buttons still be able to get clicked?

If the button is on stage on the frame - it will be available to interactions.

Translate
Guest
May 01, 2010 May 01, 2010

You can use a command stop(); in the frame you want to stop. In case of buttons - it depends on how you have implemented them. Try and post some code if there occur problems with buttons.

Regards,

gc

Translate
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
New Here ,
May 01, 2010 May 01, 2010

Thanks for the usefull reply, the problem was that i forgot the add a new keyframe that's why I couldnt make it in the frame I wanted.

I will have between 15 and 20 buttons that need to be able to get clicked when my animation is stopped, I first imported them to my library, then placed everything where I wanted it to be. Then created them as a Symbol (Selected Button!). Then I created instance names for every single of them.

With the code that's downstairs I want to let my animation go to frame 200 when I click on the button "Middenknop" while the animation is paused. But now i get this error:

TypeError: Error #1009: Kan geen eigenschap of methode benaderen via  een verwijzing naar een object dat null is.
     at Animatie2_fla::MainTimeline/frame1()

Here's the code I am currently using:

import flash.events.MouseEvent;

//---Middenknop eigenschap verandering---\\

Middenknop.addEventListener(MouseEvent.CLICK, basisClick);

function basisClick(event:MouseEvent):void{
    gotoAndPlay(200);
}

Translate
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
New Here ,
May 01, 2010 May 01, 2010

Please tell it which object would go to  frame 200 .For example, your animation is named " mc_Anim ", I would write it like this: mc_Anim.gotoAndStop(200).

Translate
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 ,
May 01, 2010 May 01, 2010

Well, as the title already says, how can I stop my animtation at a certain frame. Is it only possible due setting up a timer, or can I also enter a code that stops at a certain frame?

Here is what need to do in general:

addEventListener(Event.ENTER_FRAME, onEnterFrame);

function onEnterFrame(e:Event):void {
     if (currentFrame == 200) stop();
}

And when I stop the animation, will my buttons still be able to get clicked?

If the button is on stage on the frame - it will be available to interactions.

Translate
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
New Here ,
May 01, 2010 May 01, 2010

Thanks Andrei1, this code totally solved my problem!

For the others that responded, thanks for your usefull answers!

Translate
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 ,
May 01, 2010 May 01, 2010
LATEST

You are welcome.


Translate
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