Intro to ActionScript 3.0 Tweening
I am going to talk about how to animate using Tween objects in ActionScript. Tween objects are enormously useful. They can change any numeric property of any object over time.
For example one of the most common uses of Tween objects in ActionScript is to fade an image out as another fades in. The advantage of using a Tween object to do this instead of any of your other options is
- 1.) it is easy to understand
- 2.) it is the easiest to code
- 3.) it generally looks the best.
It’s fairly easy to write a bit of code that will change the X position of a movieClip by 2 every frame, but that will be very linear and boring. Also when does it stop? and how? You would have to create a lot of if() statements that just take forever to think through and would make your code harder to read. (VQ: lots of nested if statements are usually a thing to avoid)
With a Tween object you can use Easing methods. In the example that follows I used the Easing method Regular.easeInOut to start the motion with a little acceleration and then bring it to a stop in the same way.
If the motion of the dot gets annoying you can stop or start it again at any time by clicking on the Flash movie. (more…)



















