Packagegraphics.transitions
Classpublic class TweenTo
InheritanceTweenTo Inheritance TweenUnit Inheritance Motion Inheritance CoreTransition Inheritance CoreAction Inheritance Task Inheritance Object

The TweenTo class interpolate an object from specific number properties to other values.

Example :

     package examples 
     {
         import graphics.Align;
         import graphics.FillStyle;
         import graphics.LineStyle;
         import graphics.drawing.Pen;
         import graphics.drawing.RectanglePen;
         import graphics.easings.bounceOut;
         import graphics.transitions.TweenTo;
         
         import flash.display.Shape;
         import flash.display.Sprite;
         import flash.display.StageScaleMode;
         import flash.events.KeyboardEvent;
         import flash.ui.Keyboard;
         
         public class TweenToExample extends Sprite
         {
             public function TweenToExample()
             {
                 /// stage
                 
                 stage.scaleMode = StageScaleMode.NO_SCALE ;
                 
                 stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
                 
                 /// build and draw the shape
                 
                 var shape:Shape = new Shape() ;
                 var pen:Pen     = new RectanglePen( shape ) ;
                 
                 pen.fill = new FillStyle(0xFFFFFF) ;
                 pen.line = new LineStyle(1,0x999999) ;
                 pen.draw(0,0,32,32,Align.CENTER) ;
                 
                 shape.x = 50 ;
                 shape.y = 50 ;
                 
                 addChild( shape ) ;
                 
                 // initialize and run the tween
                 
                 var to:Object =
                 {
                     x        : 700 ,
                     y        : 250 ,
                     rotation : 180
                 };
                 
                 tween = new TweenTo( shape, to, bounceOut, 1.5, true , true ) ;
             }
             
             public var tween:TweenTo ;
             
             protected function keyDown( e:KeyboardEvent ):void
             {
                 var code:uint = e.keyCode ;
                 switch( code )
                 {
                     case Keyboard.UP :
                     {
                         tween.duration = 1 ;
                         tween.run( { x : 50 , y : 50 , rotation : 0 } ) ;
                         break ;
                     }
                     default :
                     {
                         tween.duration = 1.5 ;
                         tween.to = { x : 700 , y : 250 , rotation : 180 } ;
                         tween.run() ;
                         break ;
                     }
                 }
             }
         }
     }
     



Public Properties
 PropertyDefined By
 InheritedchangeIt : Signaler
This signal emit when the notifyChanged method is invoked.
CoreAction
 InheritedclearIt : Signaler
This signal emit when the notifyCleared method is invoked.
CoreAction
 Inheritedduration : Number
Returns the duration of the tweened animation in frames or seconds.
Motion
 Inheritedeasing : Function
Defines the easing method reference of this entry.
TweenUnit
 InheritedfinishIt : Signaler
This signal emit when the notifyFinished method is invoked.
Task
 Inheritedfps : Number
Returns the number of frames per second of the tweened animation.
Motion
  from : Object
Determinates the generic object with all numeric attributes to start the transition.
TweenTo
 Inheritedid : *
Indicates the id value of this object.
CoreTransition
 InheritedinfoIt : Signaler
This signal emit when the notifyInfo method is invoked.
CoreAction
 Inheritedlogger : Logger
Determinates the internal Logger reference of this Loggable object.
Task
 Inheritedlooping : Boolean
The flag to determinate if the Action object is looped.
CoreAction
 InheritedloopIt : Signaler
This signal emit when the notifyLooped method is invoked.
CoreAction
 InheritedpauseIt : Signaler
This signal emit when the notifyPause method is invoked.
CoreAction
 Inheritedphase : String
[read-only] The current phase of the action.
Task
 Inheritedposition : Number
The current position of this tween.
TweenUnit
 InheritedprevTime : Number
Defined the internal prevTime value.
Motion
 InheritedprogressIt : Signaler
This signal emit when the notifyProgress method is invoked.
CoreAction
 InheritedresumeIt : Signaler
This signal emit when the notifyResumed method is invoked.
CoreAction
 Inheritedrunning : Boolean
[read-only] Indicates true if the process is in progress.
Task
 InheritedstartIt : Signaler
This signal emit when the notifyStarted method is invoked.
Task
 InheritedstopIt : Signaler
This signal emit when the notifyStopped method is invoked.
CoreAction
 Inheritedstopped : Boolean
[read-only] Indicates if the motion is stopped.
Motion
 Inheritedtarget : *
Indicates the target reference of the object contrains by the Motion effect.
Motion
 Inheritedtime : Number
[read-only] Indicates the current time within the duration of the animation.
Motion
 InheritedtimeoutIt : Signaler
This signal emit when the notifyTimeOut method is invoked.
CoreAction
  to : Object
Determinates the generic object with all properties to change inside.
TweenTo
 InheriteduseSeconds : Boolean
Defined if the Motion used seconds or not.
Motion
Public Methods
 MethodDefined By
  
TweenTo(obj:* = null, to:Object = null, easing:* = null, duration:Number = 0, useSeconds:Boolean = false, auto:Boolean = false, from:* = null)
Creates a new TweenTo instance.
TweenTo
  
clone():*
[override] Returns a shallow copy of this TweenTo object.
TweenTo
 Inherited
equals(o:*):Boolean
Compares the specified object with this object for equality.
CoreTransition
 Inherited
isLocked():Boolean
Returns true if the object is locked.
Task
 Inherited
lock():void
Locks the object.
Task
 Inherited
nextFrame():void
Forwards the tweened animation to the next frame.
Motion
 Inherited
Notify when the process is changed.
CoreAction
 Inherited
Notify when the process is cleared.
CoreAction
  
[override] Notify an ActionEvent when the process is finished.
TweenTo
 Inherited
notifyInfo(info:*):void
Notify a specific information when the process is changed.
CoreAction
 Inherited
Notify when the process is looped.
CoreAction
 Inherited
Notify when the process is paused.
CoreAction
 Inherited
Notify when the process is in progress.
CoreAction
 Inherited
Notify when the process is resumed.
CoreAction
 Inherited
Notify an ActionEvent when the process is started.
Task
 Inherited
Notify when the process is stopped.
CoreAction
 Inherited
Notify when the process is out of time.
CoreAction
 Inherited
prevFrame():void
Directs the tweened animation to the frame previous to the current frame.
Motion
 Inherited
resume():void
[override] Resumes a tweened animation from its stopped point in the animation.
Motion
 Inherited
rewind(t:Number = 0):void
Rewinds a tweened animation to the beginning of the tweened animation.
Motion
  
run(... arguments):void
[override] Runs the process.
TweenTo
 Inherited
set(easing:*, duration:Number = 0, useSeconds:Boolean = false):void
Set the TweenUnit properties.
TweenUnit
 Inherited
setTime(t:Number):void
Sets the current time within the duration of the animation.
Motion
 Inherited
start():void
[override] Starts the tweened animation from the beginning.
Motion
 Inherited
Starts the intenral interval of the tweened animation.
Motion
 Inherited
stop():void
[override] Stops the tweened animation at its current position.
Motion
 Inherited
Stops the intenral interval of the tweened animation.
Motion
 Inherited
unlock():void
Unlocks the display.
Task
  
update():void
[override] Update the current Tween in the time.
TweenTo
Protected Methods
 MethodDefined By
 Inherited
setRunning(b:Boolean):void
Changes the running property value.
Task
 Inherited
setTimer(timer:ITimer):void
Sets the internal timer of the tweened animation.
Motion
Property Detail
fromproperty
from:Object

Determinates the generic object with all numeric attributes to start the transition. If this object is null, the default numeric attributes of the target are used.


Implementation
    public function get from():Object
    public function set from(value:Object):void
toproperty 
to:Object

Determinates the generic object with all properties to change inside.


Implementation
    public function get to():Object
    public function set to(value:Object):void
Constructor Detail
TweenTo()Constructor
public function TweenTo(obj:* = null, to:Object = null, easing:* = null, duration:Number = 0, useSeconds:Boolean = false, auto:Boolean = false, from:* = null)

Creates a new TweenTo instance.

Parameters
obj:* (default = null) — The target object of this tween.
 
to:Object (default = null) — A generic object to defines the value of all properties to change over the specified object during the tween process.
 
easing:* (default = null) — The easing equation reference.
 
duration:Number (default = 0) — A number indicating the length of time or number of frames for the tween motion.
 
useSeconds:Boolean (default = false) — Indicates if the duration is in seconds.
 
auto:Boolean (default = false) — Run the tween automatically.
 
from:* (default = null) — The optional generic object to defines the initial values of the numeric attributes to change.
Method Detail
clone()method
override public function clone():*

Returns a shallow copy of this TweenTo object.

Returns
* — a shallow copy of this TweenTo object.
notifyFinished()method 
override public function notifyFinished():void

Notify an ActionEvent when the process is finished.

run()method 
override public function run(... arguments):void

Runs the process.

Parameters

... arguments

update()method 
override public function update():void

Update the current Tween in the time.