Datasheet

30
Part 1: Getting Started
3.0. The ActionScript is then copied to your clipboard and you can paste this code wherever you want. If
you try this with the bouncing ball example (shown above) you get the following code:
import fl.motion.AnimatorFactory;
import fl.motion.MotionBase;
import flash.filters.*;
import flash.geom.Point;
var __motion_Ball_16:MotionBase;
//Is there animation running, if not start it
if(__motion_Ball_16 == null) {
import fl.motion.Motion;
__motion_Ball_16 = new Motion();
__motion_Ball_16.duration = 10;
// Call overrideTargetTransform to prevent the scale, skew,
// or rotation values from being made relative to the target
// object’s original transform.
// __motion_Ball_16.overrideTargetTransform();
// The following calls to addPropertyArray assign data values
// for each tweened property. There is one value in the Array
// for every frame in the tween, or fewer if the last value
// remains the same for the rest of the frames.
__motion_Ball_16.addPropertyArray(“x”, [0,0,0,0,0,0,0,0,0,0]);
__motion_Ball_16.addPropertyArray(“y”, [0,7.38399,37.4766,112.504,269.275,333.95,22
1.075,47.6064,8.68268,0]);
__motion_Ball_16.addPropertyArray(“scaleX”, [1.000000,1.000000,1.000000,1.000000,1.
000000,1.250000,1.187556,1.092333,1.023972,1.000000]);
__motion_Ball_16.addPropertyArray(“scaleY”, [1.000000,1.000000,1.000000,1.000000,1.
000000,0.750000,0.812444,0.907667,0.976028,1.000000]);
__motion_Ball_16.addPropertyArray(“skewX”, [0,0,0,0,0,0,0,0,0,0]);
__motion_Ball_16.addPropertyArray(“skewY”, [0,0,0,0,0,0,0,0,0,0]);
__motion_Ball_16.addPropertyArray(“rotationConcat”, [-0.251785,-0.251785,-
0.251785,-0.251785,-0.251785,-0.251785,-0.251785,-0.251785,-0.251785,-0.251785]);
__motion_Ball_16.addPropertyArray(“blendMode”, [“normal”]);
// Create an AnimatorFactory instance, which will manage
// targets for its corresponding Motion.
var __animFactory_Ball_16:AnimatorFactory = new AnimatorFactory(__motion_Ball_16);
__animFactory_Ball_16.transformationPoint = new Point(0.746748, 0.778455);
// Call the addTarget function on the AnimatorFactory
// instance to target a DisplayObject with this Motion.
// The second parameter is the number of times the animation
// will play - the default value of 0 means it will loop.
// __animFactory_Ball_16.addTarget( < instance name goes here > , 0); }
The code above is relatively simple. If you ve done this before in Flash 9, you ll immediately notice that
it s not XML. The above code is built completely in ActionScript using the a
ddPropertyArray method.
This new approach is designed to work with the motion editor and uses property arrays of frame - by -
frame motion tween data.
c01.indd 30c01.indd 30 12/14/09 3:03:34 PM12/14/09 3:03:34 PM