Packagecom.desuade.motion.controllers
Classpublic class MotionController
InheritanceMotionController Inheritance flash.events.EventDispatcher
Subclasses EmitterTweenController

Language Version : ActionScript 3
Since : 02.07.2009
Runtime Versions : AIR 1.0, Flash Player 9.0.0

Virtual motion editor that creates tweens similar to that of a timeline with keyframes.



Public Properties
 PropertyDefined By
  active : Boolean
[read-only] If the controller is currently running.
MotionController
  colorTweenClass : Class
[static] The default colortween class to use for emitter controllers
MotionController
  duration : Number
The duration of the entire sequence to last for in seconds.
MotionController
  keyframes : KeyframeContainer
This is what's used to store and manage keyframes.
MotionController
  property : String
The property that's being controlled and tweened.
MotionController
  sequence : Sequence
[read-only] The internal sequence created from the keyframes.
MotionController
  target : Object
The target object that will have it's property controlled.
MotionController
  tweenClass : Class
[static] The default tween class to use for emitter controllers
MotionController
Public Methods
 MethodDefined By
  
MotionController(target:Object, property:String = null, duration:Number = 0, containerClass:Class = null, tweenClass:Class = null)
Creates a new MotionController for the given target and property. MotionControllers are basically pragmatic motion editors, like those found in Flash CS4 and After Effects. They use 'keyframes' just like the timeline or motion editor to mark a position where there's a change of value. Note: DMP Keyframes are not "real" Flash keyframes, and all animation are time-based in the package, rather than frame-based) Keyframes are managed by a 'KeyframeContainer' which provides methods for adding, configuring, and working with keyframes. MotionControllers basically "take control" over a property and manage it's value over time.
MotionController
  
buildSequence(target:Object, property:String, duration:Number):ClassSequence
This creates the actual sequence object used to go through each tween.
MotionController
  
fromXML(xml:XML, useproperty:Boolean = true, useduration:Boolean = true):MotionController
Configures the MotionController from the XML object and sets the keyframes to the child KeyframeContainer XML and it's child Keyframes.
MotionController
  
rebuild():void
This rebuilds the internal sequence.
MotionController
  
setSingleTween(begin:*, beginSpread:* = 0, end:* = 0, endSpread:* = 0, ease:* = null, extras:Object = null):MotionController
This easily sets the 'begin' and 'end' keyframes of the controller to create a standard "one-shot" tween.
MotionController
  
setStartValue(keyframe:String = begin):void
This sets the initial start value of the target.
MotionController
  
start(keyframe:String = begin, startTime:Number = 0, rebuild:Boolean = false):*
Starts the controller.
MotionController
  
stop():void
This stops the controller, and all internal tweens associated to it.
MotionController
  
toXML():XML
Create an XML object that contains the MotionController config, KeyframeContainer, and all child Keyframes.
MotionController
Property Detail
activeproperty
active:Boolean  [read-only]

If the controller is currently running.


Implementation
    public function get active():Boolean
colorTweenClassproperty 
public static var colorTweenClass:Class

The default colortween class to use for emitter controllers

durationproperty 
public var duration:Number

The duration of the entire sequence to last for in seconds. This affects length of the tweens, since the position is dependent on the the duration.

keyframesproperty 
public var keyframes:KeyframeContainer

This is what's used to store and manage keyframes. To add, remove, and work with keyframes, see the documentation on KeyframeContainers.

See also

propertyproperty 
public var property:String

The property that's being controlled and tweened.

sequenceproperty 
sequence:Sequence  [read-only]

The internal sequence created from the keyframes.


Implementation
    public function get sequence():Sequence
targetproperty 
public var target:Object

The target object that will have it's property controlled.

tweenClassproperty 
public static var tweenClass:Class

The default tween class to use for emitter controllers

Constructor Detail
MotionController()Constructor
public function MotionController(target:Object, property:String = null, duration:Number = 0, containerClass:Class = null, tweenClass:Class = null)

Creates a new MotionController for the given target and property.

MotionControllers are basically pragmatic motion editors, like those found in Flash CS4 and After Effects.

They use 'keyframes' just like the timeline or motion editor to mark a position where there's a change of value.

Note: DMP Keyframes are not "real" Flash keyframes, and all animation are time-based in the package, rather than frame-based)

Keyframes are managed by a 'KeyframeContainer' which provides methods for adding, configuring, and working with keyframes.

MotionControllers basically "take control" over a property and manage it's value over time. It acts a sequence that tweens properties to the value indicated by 'keyframes', from the 'begin' keyframe to the 'end' keyframe, and any custom keyframes in between.

Parameters
target:Object — The target object that will have it's property controlled.
 
property:String (default = null) — The property that's being controlled and tweened.
 
duration:Number (default = 0) — The duration of the entire sequence to last for in seconds. This affects length of the tweens, since the position is dependent on the the duration.
 
containerClass:Class (default = null) — The class of keyframe container to use
 
tweenClass:Class (default = null) — The class of tweens to pass to the keyframe container

See also

Method Detail
buildSequence()method
public function buildSequence(target:Object, property:String, duration:Number):ClassSequence

This creates the actual sequence object used to go through each tween. This is done automatically internally.

Parameters

target:Object — The target object to use.
 
property:String — The property to use.
 
duration:Number — The duration of the sequence.

Returns
ClassSequence — ClassSequence
fromXML()method 
public function fromXML(xml:XML, useproperty:Boolean = true, useduration:Boolean = true):MotionController

Configures the MotionController from the XML object and sets the keyframes to the child KeyframeContainer XML and it's child Keyframes.

Parameters

xml:XML — The XML object containing the config for the MotionController
 
useproperty:Boolean (default = true) — If this is true, the current MotionController's property will change. If false, it will stay the same.
 
useduration:Boolean (default = true) — If this is true, the current MotionController's duration will change. If false, it will stay the same.

Returns
MotionController — The MotionController object (for chaining)
rebuild()method 
public function rebuild():void

This rebuilds the internal sequence.

setSingleTween()method 
public function setSingleTween(begin:*, beginSpread:* = 0, end:* = 0, endSpread:* = 0, ease:* = null, extras:Object = null):MotionController

This easily sets the 'begin' and 'end' keyframes of the controller to create a standard "one-shot" tween.

Parameters

begin:* — The beginning value.
 
beginSpread:* (default = 0) — The beginning spread value.
 
end:* (default = 0) — The end value for the tween.
 
endSpread:* (default = 0) — The end spread value.
 
ease:* (default = null) — The ease to use for the tween on the end keyframe.
 
extras:Object (default = null) — The extras object for the end keyframe.

Returns
MotionController — The MotionController
setStartValue()method 
public function setStartValue(keyframe:String = begin):void

This sets the initial start value of the target. This normally doesn't need to be called, as it is internally called everytime start() is.

Parameters

keyframe:String (default = begin) — This is the label of the keyframe to generate a starting value from.

start()method 
public function start(keyframe:String = begin, startTime:Number = 0, rebuild:Boolean = false):*

Starts the controller. This will internally create a Sequence (of tweens) that will be ran to match the points in the controller's PointsContainer, running from 'begin' to 'end' points.

Parameters

keyframe:String (default = begin) — The label of the keyframe to start at.
 
startTime:Number (default = 0) — This is like keyframe, but instead uses actual time to start at, as if it's already been running. This overrides the keyframe param.
 
rebuild:Boolean (default = false) — Forces a rebuild of the internal sequence on start.

Returns
* — The MotionController (for chaining)
stop()method 
public function stop():void

This stops the controller, and all internal tweens associated to it.

toXML()method 
public function toXML():XML

Create an XML object that contains the MotionController config, KeyframeContainer, and all child Keyframes.

Returns
XML — An XML object representing the MotionController