1 Reply Latest reply on Dec 14, 2016 6:28 AM by kglad

    Keyframe and Actionscript help?

    RazethAnimation Level 1

      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