13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with motion twe<strong>en</strong>s<br />

2 Select Edit > Timeline >Copy Motion as ActionScript 3.0.<br />

After copying the script, paste it into a file and save it.<br />

After creating a motion twe<strong>en</strong> and copying and saving the script, you can reuse it as is or modify it in your own<br />

dynamic ActionScript-based animation.<br />

Incorporating motion twe<strong>en</strong> scripts<br />

Flash Player 9 and later, Adobe AIR 1.0 and later, requires Flash CS3 or later<br />

The header in the ActionScript code that you copy from Flash lists all the modules required to support the motion<br />

twe<strong>en</strong>.<br />

Motion twe<strong>en</strong> classes<br />

Flash Player 9 and later, Adobe AIR 1.0 and later, requires Flash CS3 or later<br />

The ess<strong>en</strong>tial motion twe<strong>en</strong> classes are the AnimatorFactory, MotionBase, and Motion classes from the fl.motion<br />

package. You could need additional classes, dep<strong>en</strong>ding on the properties that the motion twe<strong>en</strong> manipulates. For<br />

example, if the motion twe<strong>en</strong> transforms or rotates the display object, import the appropriate flash.geom classes. If<br />

it applies filters, import the flash.filter classes. In ActionScript, a motion twe<strong>en</strong> is an instance of the Motion class.<br />

The Motion class stores a keyframe animation sequ<strong>en</strong>ce that can be applied to a visual object. The animation data<br />

includes position, scale, rotation, skew, color, filters, and easing.<br />

The following ActionScript was copied from a motion twe<strong>en</strong> that was created in Flash to animate a display object<br />

whose instance name is Symbol1_2. It declares a variable for a MotionBase object named __motion_Symbol1_2. The<br />

MotionBase class is the par<strong>en</strong>t of the Motion class.<br />

var __motion_Symbol1_2:MotionBase;<br />

Th<strong>en</strong> the script creates the Motion object:<br />

__motion_Symbol1_2 = new Motion();<br />

Last updated 6/6/2012<br />

337

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!