Package | fl.motion |
Class | public class AnimatorBase |
Inheritance | AnimatorBase EventDispatcher Object |
Subclasses | Animator, Animator3D |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
If you plan to call methods of the AnimatorBase class within a function, declare the AnimatorBase instance outside of the function so the scope of the object is not restricted to the function itself. If you declare the instance within a function, Flash Player deletes the AnimatorBase instance at the end of the function as part of Flash Player's routine "garbage collection" and the target object will not animate.
Default MXML Propertymotion
Related API Elements
Property | Defined By | ||
---|---|---|---|
autoRewind : Boolean = false
Sets the animation to restart after it finishes. | AnimatorBase | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
frameEvent : String
The name of the event object created by the Event.ENTER_FRAME event. | AnimatorBase | ||
initialPosition : Array [write-only]
An array of coordinates defining the starting location of the animation. | AnimatorBase | ||
instanceFactoryClass : Class
When creating instances with ActionScript, this is the class that creates the instance. | AnimatorBase | ||
isPlaying : Boolean [read-only]
Indicates whether the animation is currently playing. | AnimatorBase | ||
motion : MotionBase
The object that contains the motion tween properties for the
animation. | AnimatorBase | ||
motionArray : Array
The Array of objects that contains the motion tween properties
for the animation. | AnimatorBase | ||
orientToPath : Boolean = false
Sets the position of the display object along the motion path. | AnimatorBase | ||
placeholderName : String
When creating instances with ActionScript, this is the instance that appears on stage that we will replace. | AnimatorBase | ||
positionMatrix : Matrix
The Matrix object that applies an overall transformation to the motion path. | AnimatorBase | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
repeatCount : int = 1
Number of times to repeat the animation. | AnimatorBase | ||
sceneName : String
A reference for exported scenes, for 3D motion, so the scene can be loaded into a parent timeline. | AnimatorBase | ||
spanEnd : int [read-only]
Returns the frame of the target's parent on which the animation of the target ends. | AnimatorBase | ||
spanStart : int [read-only]
Returns the frame of the target's parent on which the animation of the target begins. | AnimatorBase | ||
target : DisplayObject
The display object being animated. | AnimatorBase | ||
targetName : String
The name of the target object as seen by the parent DisplayObjectContainer. | AnimatorBase | ||
targetParent : DisplayObjectContainer
The target parent DisplayObjectContainer being animated, which can be used in conjunction with targetName
to retrieve the target object after it is removed and then replaced on the timeline. | AnimatorBase | ||
targetParentButton : SimpleButton | AnimatorBase | ||
targetState3D : Array
The initial orientation for the target object. | AnimatorBase | ||
time : int
A zero-based integer that indicates and controls the time in
the current animation. | AnimatorBase | ||
transformationPoint : Point
The point of reference for rotating or scaling a display object. | AnimatorBase | ||
transformationPointZ : int
The z-coordinate point of reference for rotating or scaling a display object. | AnimatorBase | ||
usingCurrentFrame : Boolean [read-only]
Indicates whether the currentFrame property is checked whenever a new frame is entered and
whether the target's animation is synchronized to the frames in its parent's timeline,
or always advancing no matter what the parent's current frame is. | AnimatorBase |
Method | Defined By | ||
---|---|---|---|
Creates an AnimatorBase object to apply the XML-based motion tween description to a display object. | AnimatorBase | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | ||
Dispatches an event into the event flow. | EventDispatcher | ||
Stops the animation and Flash Player goes immediately to the last frame in the animation sequence. | AnimatorBase | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Advances Flash Player to the next frame in the animation sequence. | AnimatorBase | ||
Pauses the animation until you call the resume() method. | AnimatorBase | ||
Begins the animation. | AnimatorBase | ||
processCurrentFrame(parent:MovieClip, anim:AnimatorBase, startEnterFrame:Boolean, playOnly:Boolean = false):void [static] | AnimatorBase | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
registerParentFrameHandler(parent:MovieClip, anim:AnimatorBase, spanStart:int, repeatCount:int = 0, useCurrentFrame:Boolean = false):void [static]
Registers the given MovieClip and an AnimatorBase instance for a child of that MovieClip. | AnimatorBase | ||
Removes a listener from the EventDispatcher object. | EventDispatcher | ||
Resumes the animation after it has been paused
by the pause() method. | AnimatorBase | ||
Sets Flash Player to the first frame of the animation. | AnimatorBase | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Initiates frame events. | AnimatorBase | ||
Stops the animation and Flash Player goes back to the first frame in the animation sequence. | AnimatorBase | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Sets the currentFrame property whenever a new frame is entered, and
sets whether the target's animation is synchronized to the frames in its parent MovieClips's timeline. | AnimatorBase | ||
Returns the primitive value of the specified object. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Event | Summary | Defined By | ||
---|---|---|---|---|
[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | |||
[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | |||
Dispatched when the motion finishes playing, either when it reaches the end, or when the motion is interrupted by a call to the stop() or end() methods. | AnimatorBase | |||
Dispatched when the motion starts playing. | AnimatorBase | |||
Dispatched when the motion has changed and the screen has been updated. | AnimatorBase | |||
Dispatched when the Animator's time value has changed, but the screen has not yet been updated (i.e., the motionUpdate event). | AnimatorBase |
autoRewind | property |
public var autoRewind:Boolean = false
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Sets the animation to restart after it finishes.
frameEvent | property |
initialPosition | property |
instanceFactoryClass | property |
instanceFactoryClass:Class
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
When creating instances with ActionScript, this is the class that creates the instance.
Implementation
public function get instanceFactoryClass():Class
public function set instanceFactoryClass(value:Class):void
isPlaying | property |
motion | property |
motion:MotionBase
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The object that contains the motion tween properties for the animation. You cannot set both motion and motionArray to non-null values; if you set motionArray to a non-null value, then motion is set to null automatically and vice versa.
Implementation
public function get motion():MotionBase
public function set motion(value:MotionBase):void
motionArray | property |
motionArray:Array
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The Array of objects that contains the motion tween properties for the animation. You cannot set both motion and motionArray to non-null values; if you set motionArray to a non-null value, then motion is set to null automatically and vice versa. Animation using motionArray only works properly when usingCurrentFrame is true. The array should have MotionBase instances with the spanStart property set and the initialPosition property set if 3D is supported. The array instances should be placed in the array in spanStart order from lowest to highest. Also when motionArray is set, then the time property is not relative to one motion instance, but instead is absolute for the target parent, still zero-indexed, and restricted to the span of the motion (so it should be parent.currentFrame - 1 when currentFrame - 1 is greater than spanStart and less than spanEnd). Will not accept an empty array; passing an empty array is the equivalent of setting to null. The motionArray should have no null entries and the spanStart and duration entries should not have any holes in them (so for example if the first entry had spanStart == 5 and duration == 3, then the second entry would be required to have spanStart == 8).
Implementation
public function get motionArray():Array
public function set motionArray(value:Array):void
orientToPath | property |
public var orientToPath:Boolean = false
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Sets the position of the display object along the motion path. If set to true
the baseline of the display object orients to the motion path; otherwise the registration
point orients to the motion path.
placeholderName | property |
placeholderName:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
When creating instances with ActionScript, this is the instance that appears on stage that we will replace.
Implementation
public function get placeholderName():String
public function set placeholderName(value:String):void
positionMatrix | property |
public var positionMatrix:Matrix
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The Matrix object that applies an overall transformation to the motion path. This matrix allows the path to be shifted, scaled, skewed or rotated, without changing the appearance of the display object.
repeatCount | property |
public var repeatCount:int = 1
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Number of times to repeat the animation.
Possible values are any integer greater than or equal to 0
.
A value of 1
means to play the animation once.
A value of 0
means to play the animation indefinitely
until explicitly stopped (by a call to the end()
method, for example).
The default value is 1.
Related API Elements
sceneName | property |
sceneName:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
A reference for exported scenes, for 3D motion, so the scene can be loaded into a parent timeline.
Implementation
public function get sceneName():String
public function set sceneName(value:String):void
spanEnd | property |
spanEnd:int
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Returns the frame of the target's parent on which the animation of the target ends.
This value is determined using spanStart
and the motion's duration
property.
Implementation
public function get spanEnd():int
spanStart | property |
target | property |
target:DisplayObject
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The display object being animated.
Any subclass of flash.display.DisplayObject can be used, such as a MovieClip
, Sprite
, or Bitmap
.
Implementation
public function get target():DisplayObject
public function set target(value:DisplayObject):void
Related API Elements
targetName | property |
targetName:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The name of the target object as seen by the parent DisplayObjectContainer
.
This can be used in conjunction with targetParent
to retrieve the target object after it is removed and then replaced on the timeline.
Implementation
public function get targetName():String
public function set targetName(value:String):void
targetParent | property |
targetParent:DisplayObjectContainer
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The target parent DisplayObjectContainer
being animated, which can be used in conjunction with targetName
to retrieve the target object after it is removed and then replaced on the timeline.
Implementation
public function get targetParent():DisplayObjectContainer
public function set targetParent(value:DisplayObjectContainer):void
targetParentButton | property |
targetParentButton:SimpleButton
Implementation
public function get targetParentButton():SimpleButton
public function set targetParentButton(value:SimpleButton):void
targetState3D | property |
targetState3D:Array
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The initial orientation for the target object. All 3D rotation is absolute to the motion data. If you target another object that has a different starting 3D orientation, it is reset to this target state first.
Implementation
public function get targetState3D():Array
public function set targetState3D(value:Array):void
time | property |
time:int
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
A zero-based integer that indicates and controls the time in
the current animation. At the animation's first frame the
time
value is 0
. If the animation
has a duration of 10 frames, at the last frame the
time
value is 9
.
If motionArray is set to non-null, then instead of being a zero-based relative index, the time is absolute for the target parent, restricted to the span of the motion and still zero indexed (so it should be parent.currentFrame - 1 when currentFrame - 1 is greater than spanStart and less than spanEndwithin the span).
Implementation
public function get time():int
public function set time(value:int):void
transformationPoint | property |
public var transformationPoint:Point
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The point of reference for rotating or scaling a display object. For 2D motion, the transformation point is relative to the display object's bounding box. The point's coordinates must be scaled to a 1px x 1px box, where (1, 1) is the object's lower-right corner, and (0, 0) is the object's upper-left corner. For 3Dmotion (when the AnimatorBase instance is an Animator3D), the transformationPoint's x and y plus the transformationPointZ are absolute values in the target parent's coordinate space.
transformationPointZ | property |
public var transformationPointZ:int
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The z-coordinate point of reference for rotating or scaling a display object.
The transformationPointZ
property (or setter) is overridden in the AnimatorFactory3D
subclass,
In 3D, the points are not percentages like they are in 2D; they are absolute values of the original object's transformation point.
usingCurrentFrame | property |
usingCurrentFrame:Boolean
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Indicates whether the currentFrame
property is checked whenever a new frame is entered and
whether the target's animation is synchronized to the frames in its parent's timeline,
or always advancing no matter what the parent's current frame is.
Implementation
public function get usingCurrentFrame():Boolean
AnimatorBase | () | Constructor |
public function AnimatorBase(xml:XML = null, target:DisplayObject = null)
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates an AnimatorBase object to apply the XML-based motion tween description to a display object. If XML is null (which is the default value), then you can either supply XML directly to a Motion instance or you can set the arrays of property values in the Motion instance.
Parametersxml:XML (default = null ) — An E4X object containing an XML-based motion tween description.
| |
target:DisplayObject (default = null ) — The display object using the motion tween.
|
Related API Elements
end | () | method |
public function end(reset:Boolean = false, stopEnterFrame:Boolean = true, pastLastFrame:Boolean = false):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Stops the animation and Flash Player goes immediately to the last frame in the animation sequence.
If the autoRewind
property is set to true
, Flash Player goes to the first
frame in the animation sequence.
Parameters
reset:Boolean (default = false ) — Indicates whether _lastRenderedTime and _target should be reset to their original values.
_target only resets if targetParent and targetName have been supplied.
| |
stopEnterFrame:Boolean (default = true )
| |
pastLastFrame:Boolean (default = false )
|
Related API Elements
nextFrame | () | method |
public function nextFrame(reset:Boolean = false, stopEnterFrame:Boolean = true):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Advances Flash Player to the next frame in the animation sequence.
Parameters
reset:Boolean (default = false )
| |
stopEnterFrame:Boolean (default = true )
|
pause | () | method |
play | () | method |
public function play(startTime:int = -1, startEnterFrame:Boolean = true):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Begins the animation. Call the end()
method
before you call the play()
method to ensure that any previous
instance of the animation has ended before you start a new one.
Parameters
startTime:int (default = -1 ) — Indicates an alternate start time (relative frame) to use. If not specified, then the default start time of 0 is used. If motionArray is set to non-null, then startTime is not relative but absolute, just like the time property.
| |
startEnterFrame:Boolean (default = true ) — Indicates whether the event listener needs to be added to the parent in order to capture frame events.
The value can be false if the parent was registered to its AnimatorBase instance via registerParentFrameHandler() .
|
Related API Elements
processCurrentFrame | () | method |
public static function processCurrentFrame(parent:MovieClip, anim:AnimatorBase, startEnterFrame:Boolean, playOnly:Boolean = false):void
Parameters
parent:MovieClip | |
anim:AnimatorBase | |
startEnterFrame:Boolean | |
playOnly:Boolean (default = false )
|
registerParentFrameHandler | () | method |
public static function registerParentFrameHandler(parent:MovieClip, anim:AnimatorBase, spanStart:int, repeatCount:int = 0, useCurrentFrame:Boolean = false):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Registers the given MovieClip
and an AnimatorBase
instance for a child of that MovieClip
.
The parent MovieClip's FRAME_CONSTRUCTED
events are processed,
and its currentFrame
and the AnimatorBase's spanStart
properties
are used to determine the current relative frame of the animation that should be playing.
Calling this function automatically sets the AnimatorBase's useCurrentFrame
property to true
,
and its spanStart
property using the parameter of the same name.
Parameters
parent:MovieClip — The parent MovieClip of the AnimatorBase instance.
| |
anim:AnimatorBase — The AnimatorBase instance associated with the parent MovieClip.
| |
spanStart:int — The start frame of the animation in terms of the parent MovieClip's timeline.
| |
repeatCount:int (default = 0 ) — The number of times the animation should play. The default value is 0, which means the animation will loop indefinitely.
| |
useCurrentFrame:Boolean (default = false ) — Indicates whether the useCurrentFrame property is checked whenever a new frame is entered.
|
resume | () | method |
rewind | () | method |
public function rewind():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Sets Flash Player to the first frame of the animation. If the animation was playing, it continues playing from the first frame. If the animation was stopped, it remains stopped at the first frame.
startFrameEvents | () | method |
public function startFrameEvents():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Initiates frame events.
stop | () | method |
useCurrentFrame | () | method |
public function useCurrentFrame(enable:Boolean, spanStart:int):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Sets the currentFrame
property whenever a new frame is entered, and
sets whether the target's animation is synchronized to the frames in its parent MovieClips's timeline.
spanStart
is the start frame of the animation in terms of the parent's timeline.
If enable
is true
, then in any given enter frame event within the span of the animation,
the time
property is set to a frame number relative to the spanStart
frame.
For example, if a 4-frame animation starts on frame 5 (spanStart=5
),
and you have a script on frame 5 to gotoAndPlay
frame 8,
then upon entering frame 8 the time property is set to 3
(skipping time = 1
and time = 2
).
Parameters
enable:Boolean — The true or false value that determines whether the currentFrame property is checked.
| |
spanStart:int — The start frame of the animation in terms of the parent MovieClip's timeline.
|
motionEnd | Event |
fl.motion.MotionEvent
property MotionEvent.type =
fl.motion.MotionEvent.MOTION_END
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the motion finishes playing,
either when it reaches the end, or when the motion is
interrupted by a call to the stop()
or end()
methods.
Animator.stop()
or Animator.end()
,
or by reaching the end of the Motion instance.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
target | The object that dispatched the event;
it is not always the object listening for the event.
Use the currentTarget property to always access the
object listening for the event. |
motionStart | Event |
fl.motion.MotionEvent
property MotionEvent.type =
fl.motion.MotionEvent.MOTION_START
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the motion starts playing.
Indicates that the Motion instance has started playing.The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
target | The object that dispatched the event;
it is not always the object listening for the event.
Use the currentTarget property to always access the
object listening for the event. |
motionUpdate | Event |
fl.motion.MotionEvent
property MotionEvent.type =
fl.motion.MotionEvent.MOTION_UPDATE
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the motion has changed and the screen has been updated.
Indicates that the Motion instance has changed and the screen has been updated.The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
target | The object that dispatched the event;
it is not always the object listening for the event.
Use the currentTarget property to always access the
object listening for the event. |
timeChange | Event |
fl.motion.MotionEvent
property MotionEvent.type =
fl.motion.MotionEvent.TIME_CHANGE
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS4 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the Animator's time
value has changed,
but the screen has not yet been updated (i.e., the motionUpdate
event).
time
value has changed,
but the screen has not yet been updated (Flash Player has not dispatched the motionUpdate
event).
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
target | The object that dispatched the event;
it is not always the object listening for the event.
Use the currentTarget property to always access the
object listening for the event. |
Mon Nov 28 2011, 06:48 AM -08:00