import mx.transitions.easing.*;
import mx.transitions.TweenExtended;
var _tween = new TweenExtended(target, props, easeFunc, strt, end, dur, useSecs, bezierPoint1, bezierPoint2);
/*
constructor for Tween Exdended class
target: reference - the object which the Tween targets
props: array - names of the properties (in obj) that will be affected
easeFunc: function - the type of easing equation to be used [import easing equations: import mx.transitions.easing.*;]
strt: array - the starting value of props
begin: array - the ending value of props
dur: number - the length of time of the motion; set to infinity if negative or omitted
useSecs: boolean - a flag specifying whether to use seconds instead of frames
*optional bezier parameters*
To use the Bezier tween both parameters must be entered and must be used in conjunction with mx.transitions.easing.Bezier;
has three easing methods: tweenQuadBez, tweenQuadBezThru, tweenCubicBez
bezierPoint1: number - numerical x position value
bezierPoint2: number - numerical y position value
*/
We go to see some examples:
It creates a new archive in the Flash, later creates one movieclip (a ball for example) giving the name of instance of "ball_mc". Example with metodo TweenExtended.continueTo ():
Actionscript: import mx.transitions.easing.*; // optional: import all easing equations,
// or choose from: Back, Bounce, Elastic, Regular, Strong, None
import mx.transitions.TweenExtended;
var _tween:TweenExtended = new TweenExtended(ball_mc, ["_x","_y","_alpha"], Regular.easeInOut, [ball_mc._x, ball_mc._y, ball_mc._alpha], [50, 350, 50], 5, true);
//
_tween.onMotionFinished = function(obj) {
_tween.continueTo([150, 50, 90],5);
}
It sees the example working.
Example with method TweenExtended.yoyo():
Actionscript: import mx.transitions.easing.*; // optional: import all easing equations,
// or choose from: Back, Bounce, Elastic, Regular, Strong, None
import mx.transitions.TweenExtended;
var _tween:TweenExtended = new TweenExtended(ball_mc, ["_x","_y","_alpha"], Regular.easeInOut, [ball_mc._x, ball_mc._y, ball_mc._alpha], [50, 350, 50], 5, true);
//
_tween.onMotionFinished = function(obj) {
_tween.yoyo();
}
It sees the example working Example with method TweenExtended.addListener():
Actionscript: import mx.transitions.easing.*;
// optional: import all easing equations,
// or choose from: Back, Bounce, Elastic, Regular, Strong, None
import mx.transitions.TweenExtended;
//
// EventListener Object:
var eventListener:Object = new Object();
eventListener.onMotionStarted = function(obj) {
trace(obj.obj+" - onMotionStarted - eventListener");
};
eventListener.onMotionFinished = function(obj) {
trace(obj.obj+" - onMotionFinished - eventListener");
};
//
//
var _tween:TweenExtended = new TweenExtended(ball_mc, ["_x", "_y", "_alpha"], Regular.easeInOut, [ball_mc._x, ball_mc._y, ball_mc._alpha], [50, 350, 50], 5, true);
//
// register the listener:
_tween.addListener(eventListener);
It sees the example working
Example with method TweenExtended.loop:
Actionscript: import mx.transitions.easing.*;
// optional: import all easing equations,
// or choose from: Back, Bounce, Elastic, Regular, Strong, None
import mx.transitions.TweenExtended;
var _tween:TweenExtended = new TweenExtended(ball_mc, ["_x", "_y", "_alpha"], Regular.easeInOut, [ball_mc._x, ball_mc._y, ball_mc._alpha], [50, 350, 50], 5, true);
//
_tween.loop = true;
//
_tween.onMotionLooped = function(obj) {
trace(obj.obj+" - onMotionLooped");
};
It sees the example working.
Another sufficiently interesting class is the TransitionManager of the proper Flash. With it we can create transistions saw ActionScript and with effect that a certain time would take to make for timeline. We go to see an example of as to use the TransitionManager class the same using movieclip "ball_mc" used in the examples above:
No comments:
Post a Comment