RockyW Posted October 27, 2017 Share Posted October 27, 2017 Hi All, I'm trying to follow http://www.snorkl.tv/2010/09/how-to-tween-a-variable-with-flash-and-tweenlite/ to build simple number animation. Below is the sample codes: import com.greensock.*; import com.greensock.easing.*; var score:Number = 0; var targetScore:Number = 0; function showScore(){ trace(score); score_mc.score_txt.text = score; } targetScore=10; score_mc.score_txt.text = int(score); TweenLite.to(this, 4, {score:targetScore, onUpdate:showScore, ease:Linear.easeNone}); It works fine in the main timeline, however, when I run the same code in .as file it doesn't work. By doing some troubleshooting, I noticed in TweenLite.to(this, 4, {score:targetScore, onUpdate:showScore, ease:Linear.easeNone}); value cannot be passed to score (trace results shows 0 all the time). Can anyone please help? Link to comment Share on other sites More sharing options...
Carl Posted October 27, 2017 Share Posted October 27, 2017 Hello, Please keep in mind that tutorial is 7 years old. Since that tutorial was created Adobe has abandoned Flash and GreenSock has moved away from AS3 tooling. It looks to me that you will need to format that code as class or document class: https://code.tutsplus.com/tutorials/how-to-use-a-document-class-in-flash--active-3233 if you want to load it externally. For general AS3 help, check out the Adobe AS3 forums. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now