ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
fl.motion 

Motion  - AS3 Flash

Packagefl.motion
Classpublic class Motion
InheritanceMotion Inheritance MotionBase Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The Motion class stores a keyframe animation sequence that can be applied to a visual object. The animation data includes position, scale, rotation, skew, color, filters, and easing. The Motion class has methods for retrieving data at specific points in time, and interpolating values between keyframes automatically.

Note: In Flash CS3, many of the properties and methods supported by this class were members of this class, exclusively. Flash CS4 introduced a base class, KeyframeBase, for those properties and methods of this class, and they are now shared by other classes through the inheritance chain. If you have been working in Flash CS3, notice that these properties and methods are still supported by the Keyframe class, but are members of the KeyframeBase class in releases of Flash Professional after Flash CS3. As with any other class in this reference, select Show Inherited Public Properties and Show Inherited Public Methods to see all of the properties and methods supported by this class.

Default MXML PropertykeyframesCompact

Related API Elements



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedduration : int
Controls the Motion instance's length of time, measured in frames.
MotionBase
 Inheritedis3D : Boolean
Specifies whether the motion contains 3D property changes.
MotionBase
 Inheritedkeyframes : Array
An array of keyframes that define the motion's behavior over time.
MotionBase
  keyframesCompact : Array
A compact array of keyframes, where each index is occupied by a keyframe.
Motion
  source : Source
An object that stores information about the context in which the motion was created, such as frame rate, dimensions, transformation point, and initial position, scale, rotation, and skew.
Motion
Public Methods
 MethodDefined By
  
Motion(xml:XML = null)
Constructor for Motion instances.
Motion
 Inherited
addFilterPropertyArray(index:int, name:String, values:Array, startFrame:int = -1, endFrame:int = -1):void
Modifies a filter property in all corresponding keyframes for a Motion object.
MotionBase
 Inherited
Adds a keyframe object to the Motion instance.
MotionBase
 Inherited
addPropertyArray(name:String, values:Array, startFrame:int = -1, endFrame:int = -1):void
Stores an array of values in corresponding keyframes for a declared property of the Motion class.
MotionBase
  
[static] A method needed to create a Motion instance from a string of XML.
Motion
  
[override] Retrieves an interpolated ColorTransform object at a specific time index in the Motion instance.
Motion
 Inherited
getCurrentKeyframe(index:int, tweenableName:String = ""):KeyframeBase
Retrieves the keyframe that is currently active at a specific frame in the Motion instance.
MotionBase
  
[override] Retrieves an interpolated array of filters at a specific time index in the Motion instance.
Motion
 Inherited
Returns the Matrix object for the specified index position of the frame of animation.
MotionBase
 Inherited
Returns the Matrix3D object for the specified index position of the frame of animation.
MotionBase
 Inherited
getNextKeyframe(index:int, tweenableName:String = ""):KeyframeBase
Retrieves the next keyframe after a specific frame in the Motion instance.
MotionBase
 Inherited
getValue(index:Number, tweenableName:String):Number
Retrieves the value for an animation property at a point in time.
MotionBase
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
initFilters(filterClasses:Array, gradientSubarrayLengths:Array, startFrame:int = -1, endFrame:int = -1):void
Initializes the filters list for the target object and copies the list of filters to each Keyframe instance of the Motion object.
MotionBase
  
[static] Blends filters smoothly from one filter object to another.
Motion
  
interpolateFilters(fromFilters:Array, toFilters:Array, progress:Number):Array
[static] Blends filters smoothly from one array of filter objects to another.
Motion
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
overrideTargetTransform(scale:Boolean = true, skew:Boolean = true, rotate:Boolean = true):void
MotionBase
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
setValue(index:int, tweenableName:String, value:Number):void
Sets the value of a specific tweenables property at a given time index in the Motion instance.
MotionBase
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Rotates the target object when data for the motion is supplied by the addPropertyArray() method.
MotionBase
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

keyframesCompact

property
keyframesCompact:Array

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A compact array of keyframes, where each index is occupied by a keyframe. By contrast, a sparse array has empty indices (as in the keyframes property). In the compact array, no null values are used to fill indices between keyframes. However, the index of a keyframe in keyframesCompact likely does not match its index in the keyframes array.

This property is primarily used for compatibility with the Flex MXML compiler, which generates a compact array from the motion XML.



Implementation
    public function get keyframesCompact():Array
    public function set keyframesCompact(value:Array):void

Related API Elements

source

property 
public var source:Source

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

An object that stores information about the context in which the motion was created, such as frame rate, dimensions, transformation point, and initial position, scale, rotation, and skew.

Constructor Detail

Motion

()Constructor
public function Motion(xml:XML = null)

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Constructor for Motion instances. By default, one initial keyframe is created automatically, with default transform properties.

Parameters
xml:XML (default = null) — Optional E4X XML object defining a Motion instance.
Method Detail

fromXMLString

()method
public static function fromXMLString(xmlString:String):Motion

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A method needed to create a Motion instance from a string of XML.

Parameters

xmlString:String — A string of motion XML.

Returns
Motion — A new Motion instance.

getColorTransform

()method 
override public function getColorTransform(index:int):flash.geom:ColorTransform

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Retrieves an interpolated ColorTransform object at a specific time index in the Motion instance.

Parameters

index:int — The time index of a frame in the Motion instance, as an integer greater than or equal to zero.

Returns
flash.geom:ColorTransform — The interpolated ColorTransform object.

Related API Elements

getFilters

()method 
override public function getFilters(index:Number):Array

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Retrieves an interpolated array of filters at a specific time index in the Motion instance.

Parameters

index:Number — The time index of a frame in the Motion instance, as an integer greater than or equal to zero.

Returns
Array — The interpolated array of filters. If there are no applicable filters, returns an empty array.

Related API Elements

interpolateFilter

()method 
public static function interpolateFilter(fromFilter:BitmapFilter, toFilter:BitmapFilter, progress:Number):BitmapFilter

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Blends filters smoothly from one filter object to another.

Parameters

fromFilter:BitmapFilter — The starting filter object.
 
toFilter:BitmapFilter — The ending filter object.
 
progress:Number — The percent of the transition as a decimal, where 0 is the start and 1 is the end.

Returns
BitmapFilter — The interpolated filter object.

Related API Elements

interpolateFilters

()method 
public static function interpolateFilters(fromFilters:Array, toFilters:Array, progress:Number):Array

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Blends filters smoothly from one array of filter objects to another.

Parameters

fromFilters:Array — The starting array of filter objects.
 
toFilters:Array — The ending array of filter objects.
 
progress:Number — The percent of the transition as a decimal, where 0 is the start and 1 is the end.

Returns
Array — The interpolated array of filter objects.

Related API Elements