Robert Penner, use built-in Flash MX 2004 classes to script tweens. This is the touch of class that adds to any flash application / navigation / presentation. To set it up, you define an ease type, then apply the ease type to a Tween object.">
First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Brady White | Website:
Penner Motion Tweens Tutorial

Penner Tweens, created by Robert Penner, use built-in Flash MX 2004 classes to script tweens. This is the touch of class that adds to any flash application / navigation / presentation. To set it up, you define an ease type, then apply the ease type to a Tween object.

File -> New… -> Flash Document

Flash New Document

Double-Click ‘Layer 2′ and label it “A” (for Actions). We will place all actionscript on this layer.

Create a new layer (Insert -> Timeline -> Layer). Double-Click ‘Layer 2′ and label it “mc” (for movieclips).

Our new timeline

Draw a box using the Rectangle Tool (hotkey is ‘R’) near the top left of the Stage.

Double-Click on your new box. Now Right-Click on your box and select “Convert to Symbol…".

In the ‘Name’ field put “m_box". In the ‘Behavior’ radio button group, select “Movie clip". Press ‘OK’.

Convert symbol

Having your m_box on the stage still selected, in the ‘Properties’ toolbar, where there is a white field that has ” ” enter “box_mc". Notice that the instance name on the stage is different than the instance name on the stage. We use the “_mc” naming convention for actionscript hints in our code.

Instance name on stage

Next, select Frame ‘1′ in the ‘A’ Layer. Open up your actions panel (Window -> Development Panels -> Actions or using hotkey ‘F9′). Copy and paste this code into the ‘Actions’ panel.

var easeType = mx.transitions.easing.Regular.easeOut;
myTween = new mx.transitions.Tween(box_mc, “_y", easeType, 0, 300, 30);

Actionscript in Actions panel

Now you might be asking what this just did. Well lets take an indepth look at the code defintion of the Tween object.
(do not enter this code into your movie):

Tween(myMovie:MovieClip, myProperty:Property, easeType, startValue:Number, endValue:Number, frames(or seconds), secondsSet:Boolean);

myMovie:MovieClip – Targets the Instance of a Movieclip on the stage.
myProperty:Property – Selects the property of the Movieclip on the stage to tween. (I.E. _x, _width, _alpha, etc)
easeType as (Parent.Child) – Your tween definition set up as a variable. SetParent Types (Back, Bounce, Elastic, None, Regular, Strong). Child Types (easeIn, easeOut). (i.e. Bounce.easeOut).
startValue:Number – Starting value of property to tween. For more advanced tweens, try (box_mc._y) to get the current starting Y position of the targeted Movie Clip.
endValue:Number – Starting value of property to tween.
frames(or seconds) – Number of frames to tween over, or number of seconds to tween over.
secondsSet:Boolean – Optional value, defaults to false. When set to true, uses seconds instead of frames to tween over.

Save your document (File -> Save)

Test your movie (Control -> Test Movie or hotkey “Ctr-Enter")

Your box should go from _y position 0 to 300. Now try out variations of properties and movieclips and tweens.

For smoother framerate, try changing the framerate to 31 fps. To do so, go to Modfiy -> Document… . In the Frame rate input box, type in ‘31′. Press ‘OK’. Try your movie again.

Change Frames Per Second (FPS)

For more easing variations, view the folder on your computer >>
..Program Files/Macromedia/Flash MX 2004/en/First Run/Classes/mx/transitions

Try out Rober Penner’s examples at:
Robert Penner’s Easing Demo

Download Source Files.

» Level Basic

Added: 2004-11-16
Rating: 7 Votes: 9
(10 being the highest)
» Author
Brady White is an aspiring web developer in Utah.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.