Packageorg.apache.flex.effects
Classpublic class Tween
InheritanceTween Inheritance Effect Inheritance EventDispatcher Inheritance flash.events.EventDispatcher
Subclasses Fade, Move, Resize, Wipe

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

Tween is the underlying animation class for the effects in FlexJS. The Tween class defines a tween, a property animation performed on a target object over a period of time. That animation can be a change in position, such as performed by the Move effect; a change in size, as performed by the Resize or Zoom effects; a change in visibility, as performed by the Fade or Dissolve effects; or other types of animations.

A Tween instance accepts the startValue, endValue, and duration properties, and an optional easing function to define the animation.



Public Properties
 PropertyDefined By
  activeTweens : Object
[static] The list of tweens that are currently playing.
Tween
  currentTime : Number = NaN
[static] Used by effects to get the current effect time tick.
Tween
 Inheritedduration : Number
Duration of the animation, in milliseconds.
Effect
  easingFunction : Function
[write-only] Sets the easing function for the animation.
Tween
  endValue : Number
Final value of the animation.
Tween
  listener : Object
Object that is notified at each interval of the animation.
Tween
  startValue : Number
Initial value of the animation.
Tween
Public Methods
 MethodDefined By
  
Constructor.
Tween
 Inherited
Effect
 Inherited
Effect
  
endTween():void
Interrupt the tween, jump immediately to the end of the tween, and invoke the onTweenEnd() callback function.
Tween
  
pause():void
[override] Pauses the effect until you call the resume() method.
Tween
  
play():void
[override] Stops the tween, ending it without dispatching an event or calling the Tween's endFunction or onTweenEnd().
Tween
  
resume():void
[override] Resumes the effect after it has been paused by a call to the pause() method.
Tween
  
reverse():void
[override] Plays the effect in reverse, starting from the current position of the effect.
Tween
  
seek(playheadTime:Number):void
Advances the tween effect to the specified position.
Tween
  
stop():void
[override] Stops the tween, ending it without dispatching an event or calling the Tween's endFunction or onTweenEnd().
Tween
Public Constants
 ConstantDefined By
 InheritedEFFECT_END : String = effectEnd
[static] The Effect.EFFECT_END constant defines the value of the event object's type property for a effectEnd event.
Effect
 InheritedEFFECT_START : String = effectStart
[static] The Effect.EFFECT_START constant defines the value of the event object's type property for a effectStart event.
Effect
 InheritedEFFECT_STOP : String = effectStop
[static] The Effect.EFFECT_STOP constant defines the value of the event object's type property for a effectStop event.
Effect
  TWEEN_END : String = tweenEnd
[static] The Tween.TWEEN_END constant defines the value of the event object's type property for a tweenEnd event.
Tween
  TWEEN_START : String = tweenStart
[static] The Tween.TWEEN_START constant defines the value of the event object's type property for a tweenStart event.
Tween
  TWEEN_UPDATE : String = tweenUpdate
[static] The Tween.TWEEN_UPDATE constant defines the value of the event object's type property for a tweenUpdate event.
Tween
Property Detail
activeTweensproperty
public static var activeTweens:Object

The list of tweens that are currently playing.

currentTimeproperty 
public static var currentTime:Number = NaN

Used by effects to get the current effect time tick.

easingFunctionproperty 
easingFunction:Function  [write-only]

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Sets the easing function for the animation. The easing function is used to interpolate between the startValue value and the endValue. A trivial easing function does linear interpolation, but more sophisticated easing functions create the illusion of acceleration and deceleration, which makes the animation seem more natural.

If no easing function is specified, an easing function based on the Math.sin() method is used.

The easing function follows the function signature popularized by Robert Penner. The function accepts four arguments. The first argument is the "current time", where the animation start time is 0. The second argument is a the initial value at the beginning of the animation (a Number). The third argument is the ending value minus the initial value. The fourth argument is the duration of the animation. The return value is the interpolated value for the current time (usually a value between the initial value and the ending value).

Flex includes a set of easing functions in the mx.effects.easing package.


Implementation
    public function set easingFunction(value:Function):void
endValueproperty 
public var endValue:Number

Final value of the animation.

listenerproperty 
public var listener:Object

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Object that is notified at each interval of the animation.

startValueproperty 
public var startValue:Number

Initial value of the animation.

Constructor Detail
Tween()Constructor
public function Tween()

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Constructor.

Method Detail
endTween()method
public function endTween():void

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Interrupt the tween, jump immediately to the end of the tween, and invoke the onTweenEnd() callback function.

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

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Pauses the effect until you call the resume() method.

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

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Stops the tween, ending it without dispatching an event or calling the Tween's endFunction or onTweenEnd().

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

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Resumes the effect after it has been paused by a call to the pause() method.

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

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Plays the effect in reverse, starting from the current position of the effect.

seek()method 
public function seek(playheadTime:Number):void

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Advances the tween effect to the specified position.

Parameters

playheadTime:Number — The position, in milliseconds, between 0 and the value of the duration property.

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

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Stops the tween, ending it without dispatching an event or calling the Tween's endFunction or onTweenEnd().

Constant Detail
TWEEN_ENDConstant
public static const TWEEN_END:String = tweenEnd

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

The Tween.TWEEN_END constant defines the value of the event object's type property for a tweenEnd event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe 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.
targetThe 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.
valueThe value passed to the onTweenEnd() method.

See also

org.apache.flex.effects.Effect
org.apache.flex.effects.TweenEffect
org.apache.flex.events.EffectEvent
TWEEN_STARTConstant 
public static const TWEEN_START:String = tweenStart

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

The Tween.TWEEN_START constant defines the value of the event object's type property for a tweenStart event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe 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.
targetThe 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.
valueThe value passed to the onTweenUpdate() method.

TWEEN_UPDATEConstant 
public static const TWEEN_UPDATE:String = tweenUpdate

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

The Tween.TWEEN_UPDATE constant defines the value of the event object's type property for a tweenUpdate event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe 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.
targetThe 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.
valueThe value passed to the onTweenUpdate() method.