Tweening
The Tween Class inside flash lets us create simple animations easily in ActionScript by specifying the starting and ending points of an object animation positions. It can actually be used to tween any property of any object.
By the term tween we mean here the gradual increase or decrease of the value of a property which can bring about an animation. This could be the increase of transparency, the decrease in width, or the movement from left to right of any object.
The Tween Class is not included by default in a Flash movie and must be imported before it can be used, Adobe did this to ensure to help making SWF files smaller so that the Class is included only in movies that require it. To import this class you must use the import directive at the beginning before you start your actual code. Here is the code you need:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
The Tween Class must be used through an instance of it (using a variable).
When instantiating the Tween Class you must provide the parameters required by the TWeen Class.
var |
myTween | : | Tween | = | new Tween | ( | object | , | "property | , | EasingType | , | begin | , | end | , | duration | , | time | ) | ; | |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
var |
name | : | data type | = | initial value | ( | 1 | , | 2 | , | 3 | , | 4 | , | 5 | , | 6 | , | Boolean | ) | ; |
var rectTween:Tween =new Tween ( (rectangle_mc, "x", Strong.easeOut, 0 , 300, 3, true)