Jump to content
GreenSock

jjmorga

tweening a numeric variable?

Recommended Posts

can I use tweenlite/nano to tween a number variable with ease etc? whats the syntax for this and how would one populate this number into a text field that actually displays the numbers tweening up? thanks in advance!

Link to comment
Share on other sites

var myNumber:Number = 0;
TweenLite.to(this, 2, {myNumber:100, onUpdate:updateText, ease:Strong.easeOut});
function updateText():void {
   myTextField.text = String(int(myNumber));
}

Link to comment
Share on other sites

  • 4 months later...

i simply cant get this working in a class structure! any ideas?

 

ReferenceError: Error #1069: Property myNumber not found on LightningSample and there is no default value.
at com.greensock::TweenNano/init()
at com.greensock::TweenNano/renderTime()
at com.greensock::TweenNano$/updateAll()

Link to comment
Share on other sites

Did you make sure your variable is public? And it should have a default value so that it's not NaN at the beginning of the tween.

 

public var myNumber:Number = 0;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×