1 Reply Latest reply: Jul 17, 2013 6:04 PM by kglad RSS

    reversing animation with actionscript 3

    mentalcase129 Community Member

      I'm making a website with basic timeline navigation.  Which is typically how I prefer to work because I'm from an animation background and more visually oriented then code oriented.  I'm wondering if it's possible to play in reverse along the timeline so that if animation plays when you navigate to one section it will then play in reverse when I click the back button.  Is this at all possible...or a simple method that would achieve the same effect?

        • 1. Re: reversing animation with actionscript 3
          kglad CommunityMVP

          you can call mcF to play any timeline from any frame to any other frame by passing the movieclip, start frame and end frame.

           

          for example, to play the root timeline from frame 33 to frame 1 (ie, in reverse), use:

           

          mcF(MovieClip(root),33,1);

           

           

          // change nothing below

          function mcF(mc:MovieClip,startFrame:int,endFrame:int):void{

          mc.startFrame = startFrame;

          mc.endFrame = endFrame;

          mc.addEventListener(Event.ENTER_FRAME,playF);

          }

          function playF(e:Event):void{

          var mc:MovieClip = MovieClip(e.currentTarget);

          if(mc.startFrame<mc.endFrame){

          mc.nextFrame();

          } else if(mc.startFrame>mc.endFrame){

          mc.prevFrame();

          }

          if(mc.currentFrame==mc.endFrame){

          mc.removeEventListener(Event.ENTER_FRAME,playF);

          }

          }