| |
|
import mx.transitions.Tween;
import mx.transitions.easing.*;
new Tween(ball_mc, "_y",
Bounce.easeOut,ball_mc._y, 200, 3, true);
|
Note: Press
the "refresh" button in the browser to play the animation
again. |
// The tween transition class is imported.
import mx.transitions.Tween;
// This uses the "wildcard"
symbol "*" to imaport all six of the
easing classes in a package.
// This package contains multiple classes in a single directory folder.
import mx.transitions.easing.*;
// A new tween is contructed and defined using the tween
class syntax:
// Tween (object, property, function, begin, end, duration, useSeconds).
new Tween(ball_mc, "_y", Bounce.easeOut,
ball_mc._y, 250, 3, true);
// The object being tweened
is ball_mc.
// The property "_y" indeicates
the vertical position of the movie clip is
to be tweened.
// Bounce indicates that the
ball will bounce moving up and down and reducing
its height after each bounce.
// easeOut dicates to the
movie clip that it decelerate toward the end
of the transition.
// ball_mc_y sets the initial
position of the movie clip Ball_mc as the stating
point for the transition.
// 250 sets the final coordinates
of the movie clip.
// 3 sets the duration of
the animation to 3 units.
// true uses boolean logic
to set the units for the duration of the tween
to seconds.
|