Copy link to clipboard
Copied
Hello everyone, I need some help with Animate and Actionscript and keyframing.
I will use examples
Frame I start on: Anim1
End of Anim1: EAnim1
Frame I want to transition to: Anim2
End of Anim2: EAnim2
Button name: AdvanceButton
If the user clicks a button, it is set up to go directly to Anim2 on click with this command:
import flash.events.MouseEvent;
AdvanceButton.addEventListener(MouseEvent.CLICK, PlayAnim2);
function PlayAnim2(event:MouseEvent):void {
this.gotoAndPlay("Anim2")
}
So that will work fine. But I want it to only go to Anim2 AFTER Anim1 is done playing. Note: Anim1 is playing in a loop. So i want it to go to Anim2 after Anim1 finishes the current loop it is on, or when the time reaches the frame named EAnim1. Only when the AdvanceButton is clicked though. It needs to play the whole loop of Anim1 or the transition to Anim2 does not look smooth. Any help?
Actionscript 3.0
Animate CC 2015
EDIT:
I was thinking if there was a way to do this (anything that i do not know how to code are in italics below)
import flash.events.MouseEvent;
AdvanceButton.addEventListener(MouseEvent.CLICK, PlayAnim2);
function PlayAnim2(event:MouseEvent):void {
var buttoncounter = 1;
}
then at the frame EAmin1 the script would be
if (buttoncounter = 1)
{
this.gotoAndPlay("Anim2");
}
else
{
this.gotoAndPlay("Anim1");
}
i may have just solved my issue hold on
when your button is clicked you can start a loop (eg, enterframe) that repeatedly checks if the currentFrameLabel=='EAnim1' and then terminate the loop and goto 'Anim2'.
p.s. if your user is not expecting that behavior they will think your button is broken.
Copy link to clipboard
Copied
when your button is clicked you can start a loop (eg, enterframe) that repeatedly checks if the currentFrameLabel=='EAnim1' and then terminate the loop and goto 'Anim2'.
p.s. if your user is not expecting that behavior they will think your button is broken.