Packagefl.motion
Classpublic class Motion
InheritanceMotion Inheritance Object

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.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.

Default MXML PropertykeyframesCompact

See also

Motion XML Elements


Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  duration : int
Controls the Motion instance's length of time, measured in frames.
Motion
  keyframes : Array
An array of keyframes that define the motion's behavior over time.
Motion
  keyframes : Array
Motion
  keyframesCompact : Array
A compact array of keyframes, where each index is occupied by a keyframe.
Motion
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  source : Source
An object that stores information about the context in which the motion was created, such as framerate, dimensions, transformation point, and initial position, scale, rotation and skew.
Motion
Public Methods
 MethodDefined By
  
Motion(xml:XML = null)
Constructor for Motion instances.
Motion
  
addKeyframe(newKeyframe:Keyframe):void
Adds a keyframe object to the Motion instance.
Motion
  
[static] A method needed to create a Motion instance from a string of XML.
Motion
  
Retrieves an interpolated ColorTransform object at a specific time index in the Motion instance.
Motion
  
getCurrentKeyframe(index:int, tweenableName:String = ""):Keyframe
Retrieves the keyframe that is currently active at a specific frame in the Motion instance.
Motion
  
Retrieves an interpolated array of filters at a specific time index in the Motion instance.
Motion
  
getNextKeyframe(index:int, tweenableName:String = ""):Keyframe
Retrieves the next keyframe after a specific frame in the Motion instance.
Motion
  
getValue(index:Number, tweenableName:String):Number
Retrieves the value for an animation property at a point in time.
Motion
 Inherited
Indicates whether an object has a specified property defined.
Object
  
[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
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
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.
Motion
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail
durationproperty
duration:int  [read-write]

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

Controls the Motion instance's length of time, measured in frames. The duration cannot be less than the time occupied by the Motion instance's keyframes.

The default value is 0.


Implementation
    public function get duration():int
    public function set duration(value:int):void
keyframesproperty 
public var keyframes:Array

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

An array of keyframes that define the motion's behavior over time. This property is a sparse array, where a keyframe is placed at an index in the array that matches its own index. A motion object with keyframes at 0 and 5 has a keyframes array with a length of 6. Indices 0 and 5 in the array each contain a keyframe, and indices 1 through 4 have null values.

keyframesproperty 
public var keyframes:Array
keyframesCompactproperty 
public var keyframesCompact:Array

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.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.

See also

sourceproperty 
public var source:Source

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

An object that stores information about the context in which the motion was created, such as framerate, 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
Player Version : Flash Player 9.0.28.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
addKeyframe()method
public function addKeyframe(newKeyframe:Keyframe):void

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

Adds a keyframe object to the Motion instance.

Parameters

newKeyframe:Keyframe — A keyframe object with an index property already set.

See also

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

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.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 
public function getColorTransform(index:int):ColorTransform

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.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
ColorTransform — The interpolated ColorTransform object.

See also

getCurrentKeyframe()method 
public function getCurrentKeyframe(index:int, tweenableName:String = ""):Keyframe

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

Retrieves the keyframe that is currently active at a specific frame in the Motion instance. A frame that is not a keyframe derives its values from the keyframe that preceded it.

This method can also filter values by the name of a specific tweenables property. You can find the currently active keyframe for x, which may not be the same as the currently active keyframe in general.

Parameters

index:int — The index of a frame in the Motion instance, as an integer greater than or equal to zero.
 
tweenableName:String (default = "") — Optional name of a tweenable's property (like "x" or "rotation").

Returns
Keyframe — The closest matching keyframe at or before the supplied frame index.

See also

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

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.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, 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.

See also

getNextKeyframe()method 
public function getNextKeyframe(index:int, tweenableName:String = ""):Keyframe

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

Retrieves the next keyframe after a specific frame in the Motion instance. If a frame is not a keyframe, and is in the middle of a tween, this method derives its values from both the preceding keyframe and the following keyframe.

This method can also filter by the name of a specific tweenables property. This allows you to find the next keyframe for x, which may not be the same as the next keyframe in general.

Parameters

index:int — The index of a frame in the Motion instance, as an integer greater than or equal to zero.
 
tweenableName:String (default = "") — Optional name of a tweenable's property (like "x" or "rotation").

Returns
Keyframe — The closest matching keyframe after the supplied frame index.

See also

getValue()method 
public function getValue(index:Number, tweenableName:String):Number

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

Retrieves the value for an animation property at a point in time.

Parameters

index:Number — The time index of a frame in the Motion instance, as an integer greater than or equal to zero.
 
tweenableName:String — The name of a tweenable's property (like "x" or "rotation").

Returns
Number

See also

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

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.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.

See also

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

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.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.

See also

setValue()method 
public function setValue(index:int, tweenableName:String, value:Number):void

Language Version : ActionScript 3.0
Player Version : Flash Player 9.0.28.0

Sets the value of a specific tweenables property at a given time index in the Motion instance. If a keyframe doesn't exist at the index, one is created automatically.

Parameters

index:int — The time index of a frame in the Motion instance, as an integer greater than zero. If the index is zero, no change is made. Because the transform properties are relative to the starting transform of the target object, the first frame's values are always default values and should not be changed.
 
tweenableName:String — The name of a tweenable's property (like "x" or "rotation").
 
value:Number — The new value of the tweenable property.

See also