Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 Knowledgebase
Creating A Vertically Moving Ball I Tween Class  


Download

Actionscript

import mx.transitions.Tween;
import mx.transitions.easing.*;

new Tween(ball_mc, "_y", Regular.easeIn,ball_mc._y, 250, 1, 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 "wilcard" 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", Regular.easeIn, ball_mc._y, 250, 1, true);

// The object being tweened is ball_mc.
// The property "_y" indeicates the vertical position of the movie clip is to be tweened.
// Regular indicates that the ball's acceleration will be of normal "strength".
// easeIn dicates to the movie clip that its rate of motion accelerate towards then 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.
// 1 sets the duration of the animation to 3 units.
// true uses boolean logic to set the units for the duration fo the tween to seconds.


© 2008 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us