Copy link to clipboard
Copied
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
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thanks Andrei1, this code totally solved my problem!
For the others that responded, thanks for your usefull answers!
Copy link to clipboard
Copied
You are welcome.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more