How to Play Reverse Frames Flash on AS3

Written by mark stansberry
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Play Reverse Frames Flash on AS3
Use AS3 code to flashback frames in reverse. ( Images)

Reversing frames with Flash ActionScript 3 (AS3) code comes in handy when creating Flash movies. For example, by reversing the frame sequence for a sunset animation you can quickly create a sunrise, eliminating the need to create a sunrise animation from scratch. There is no reverse frame command in AS3. As a result, playing frames in reverse with AS3 requires that you write AS3 code that will force the animation to start at the last frame and step one frame back every time a frame event occurs.

Skill level:

Things you need

  • Adobe Flash Professional: CS3, CS4 or CS5 Versions

Show MoreHide


  1. 1

    Start the Flash program and select "Flash File(ActionScript 3.0)" from the splash screen to allow AS3 code to be used to build your movie.

  2. 2

    Click the "Timeline" option from the "Window" menu to display the timeline. Press the "F6" key on your keyboard to insert a keyframe on the timeline. Continually press the "F6" key until 30 keyframes have been inserted on the timeline. Tiny circles will be placed in each frame to signify that the frame is a blank keyframe.

  3. 3

    Position your mouse cursor over "Frame 1" in the timeline and click your left mouse button to select it. Press the "R" key on your keyboard to activate the rectangle drawing tool. Position your mouse cursor over the stage, then click and drag your mouse to draw a rectangle. Release the left mouse button to set the size of the rectangle. Click "Frame 2" on the timeline and draw another rectangle, but at a different position on the stage. Continue drawing rectangles on each frame in different positions until you have reached frame 20.

  4. 4

    Position your mouse cursor over "Frame 1," then click your left mouse button to select Frame 1. Press the "F9" key on your keyboard to open the Actions editor and write the reverse frames AS3 code in Frame 1.

  5. 5

    Position your mouse cursor on the first line of the Actions editor. Click your mouse button and type in the code below. This will instruct Flash to go to the end of the movie (frame 30) and display the frame preceding the last frame displayed (starting at 30) every time a new frame is displayed (at the frame rate in frames per second specified in the "fps" text box in the Timeline panel).


    addEventListener(Event.ENTER_FRAME, reverse);

    function reverse(reverseevent:Event):void




Tips and warnings

  • Although reversing frames with ENTER_FRAME is effective, the Yoyo method of the Tween class will also reverse the motion sequence of an object if the original forward motion was also applied with a Tween object and method. See "Republic of Code; Tween Class in Flash ActionScript" listed in the Resources section for further details.
  • If you have written ActionScript code in different frames in your Flash movie you will have to write the AS3 code to reverse the frames with that code in mind. And that's because when you step the frames backwards, the code in the frames will also be executed in reverse order.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.