Main Page | Packages | Class Tree | Index | Help

xp.util

class TweenTimer

Object
  |
  +--xp.util.TweenTimer


class TweenTimer
extends Object

A control that manages a time based tween

A control which provides the abilty to change poperty values over time.
Usually you will call the static methods of thisclass to create the tween. This control is highly configurable and can support multi property tweens.
A tween can be created that is completely automated. It starts, updates properties itself, finishes and cleans up after itself. See startTweenFade for an example. A context object can be apssed on all evnt scall. The context object can contain any information you like can can help you in processing the tween event.

If onTweenUpdate/onTweenComplete/onTweenDone handlers are specified they are called.
If not specifeid and properties are then the proeprties will be automaticallly updated.
If neither are set then the target clip is called directly with the handlers.


Author:
ProWin Computers Ltd. - Rob Edgar

Version:
3.0.0.000

See also:


Field Summary

public
active: Boolean
Indicates whether the tween is active

public
arrayMode: Boolean
Indicates the mode, if tween an array of propeties this field is true otherwise false

public
context: Object
A context object that is passed toi the event handlers. The content can be anything you wish.

public
duration: Number
The duratoin in ms of the tween

public
ID: Number
A unique Id for this tween

public
onTweenComplete
A callback handler for the onTweenComplete event

public
onTweenDone
A callback handler for the onTweenDone event

public
onTweenUpdate
A callback handler for the onTweenUpdate event

public
property
The property or array of properties being tweened

public
startTime: Number
The system time in ms when the tween started

public
target: Object


public
valBegin
The property or array of property values at the start of the tween.

public
valEnd
The property or array of property values at the end of the tween

Constructor

public
TweenTimer ( tgt: Object, valBegin, valEnd, dur: Number, property, context: Object, onTweenUpdate, onTweenComplete, onTweenDone)
Creates a new TweenTimer instances

Method Summary

public static
addTween ( tween: TweenTimer ): Void
Adds a TweenTimer to the managers list of active tweens

public
easingEquation ( t, b, c, d )
The easing equation

public
getCurVal ( curTime ): Object
Gets the property value or values at he specified point in time

public
onComplete ( )
Called when the tween is complete

public
onUpdate ( )
Called to update the tweenable properties.

public static
removeTween ( tween: TweenTimer )
Removes a TweenTimer from the managers list of active tweens

public
start ( )
Starts or restarts a tween

public static
startTween ( tgt: Object, valBegin, valEnd, dur: Number, property, context: Object, onTweenUpdate, onTweenComplete, onTweenDone ): TweenTimer
Creates, configures and starts a TweenTimer

public static
startTweenFade ( tgt: MovieClip, inc: Boolean, context, onTweenDone ): TweenTimer
Creates a fade in/out tween



Field Documentation

active

public var active: Boolean
Indicates whether the tween is active

arrayMode

public var arrayMode: Boolean
Indicates the mode, if tween an array of propeties this field is true otherwise false

context

public var context: Object
A context object that is passed toi the event handlers. The content can be anything you wish.

duration

public var duration: Number
The duratoin in ms of the tween

ID

public var ID: Number
A unique Id for this tween

onTweenComplete

public var onTweenComplete
A callback handler for the onTweenComplete event

This event fires on the last interval event of the tween and allows you to set the final tween value This can be a function on the target or a delegate.

onTweenDone

public var onTweenDone
A callback handler for the onTweenDone event

This event fires immediately after the onTweenComplete event and allows you to tidy up after the tween. This can be a function on the target or a delegate. Note: The function can call to a different object than onTweenComplete. A use for this is to have one object processing a specific tween and another that tidies up all tweens

onTweenUpdate

public var onTweenUpdate
A callback handler for the onTweenUpdate event

property

public var property
The property or array of properties being tweened

startTime

public var startTime: Number
The system time in ms when the tween started

target

public var target: Object

valBegin

public var valBegin
The property or array of property values at the start of the tween.

valEnd

public var valEnd
The property or array of property values at the end of the tween


Constructor Documentation

TweenTimer

public function TweenTimer(tgt: Object,
 valBegin,
 valEnd,
 dur: Number,
 property,
 context: Object,
 onTweenUpdate,
 onTweenComplete,
 onTweenDone)
Creates a new TweenTimer instances

Parameters:
tgt
The clip to be faded
valBegin
The property value at the start. This can be an array if you are tweening an array of properties.
valEnd
The property value at the end. This can be an array if you are tweening an array of properties.
dur
The duration of the tween.
property
The property being tweened. This can be an array if you are tweening an array of properties.
context
A context object that is passed to the onUpdate handler when tweening
onTweenUpdate
A custom handler for the onTweenUpdate event.
onTweenComplete
A custom handler for the onTweenComplete event.
onTweenDone
A custom handler for the onTweenDone event.

Method Documentation

addTween

public static function addTween(tween: TweenTimer): Void
Adds a TweenTimer to the managers list of active tweens

A TweenTimer will not fire any events until added to the tween manager

Parameters:
tween
The TweenTimer

easingEquation

public function easingEquation(t,
 b,
 c,
 d)
The easing equation

This can be replaced by any equstion you like

Parameters:
t
current time
b
beginning value
c
increase value (end value - begin value)
d
duration

getCurVal

public function getCurVal(curTime): Object
Gets the property value or values at he specified point in time

Parameters:
curTime
The current elapsed time for this tween
Returns:
A value or array of values

onComplete

public function onComplete()
Called when the tween is complete

onUpdate

public function onUpdate()
Called to update the tweenable properties.

removeTween

public static function removeTween(tween: TweenTimer)
Removes a TweenTimer from the managers list of active tweens

A TweenTimer will not fire any events after it is removed from the tween manager

Parameters:
tween
The TweenTimer

start

public function start()
Starts or restarts a tween

startTween

public static function startTween(tgt: Object,
 valBegin,
 valEnd,
 dur: Number,
 property,
 context: Object,
 onTweenUpdate,
 onTweenComplete,
 onTweenDone): TweenTimer
Creates, configures and starts a TweenTimer

Parameters:
tgt
The clip to be faded
valBegin
The property value at the start. This can be an array if you are tweening an array of properties.
valEnd
The property value at the end. This can be an array if you are tweening an array of properties.
dur
The duration of the tween.
property
The property being tweened. This can be an array if you are tweening an array of properties.
context
A context object that is passed to the onUpdate handler when tweening
onTweenUpdate
A custom handler for the onTweenUpdate event.
onTweenComplete
A custom handler for the onTweenComplete event.
onTweenDone
A custom handler for the onTweenDone event.
Returns:
A configured TweenTimer

startTweenFade

public static function startTweenFade(tgt: MovieClip,
 inc: Boolean,
 context,
 onTweenDone): TweenTimer
Creates a fade in/out tween

Parameters:
tgt
The clip to be faded
inc
If true fades in otherwise fades out
context
onTweenDone
Returns:
A configured TweenTimer


The documentation was generated from the following file:


Generated on 10/30/2005 9:34:02 PM by AS2Doc