Tween A Number with GreenSock’s Tweening Class

I am going to give you a little example on how to tween a number. This example can be used with other tweening classes as well like Caurina’s Tweener.

Pay attention that the variable we want to tween needs to be public otherwise you’ll get an error compiling the code.

We are going define a variable as an Object. This object will hold a value. The tweener will tween this object’s value.

public var my_number :Object  =  { value: 0 }; this.my_number,  .5, { value: 100 , onUpdate:function(){ trace (this.value); } } )


TweenMax Timer

A little dirty trick I found ( I’m sure already found by others ) using TweenMax class.

After reading more carefully the documentation I found this:


[static] Provides a simple way to call a function after a set amount of time (or frames).
Example: TweenMax.delayedCall(delay:5, onComplete: some_function)