"dynTween" allows to apply motion tweens totally
dynamically to movieclips.
Usage example:
myMC.dynTween ( { duration: 40, _x: [400, "out", 30], _y: [200, "in"] } );
This will move "myMC" from the current position
to (400,200) during 40 frames with easing effects,
"out" with strength 30 for _x and "in"
with strength 50 as a default for _y.
As seen there, the parameter(s) should be passed in a form
of object(s).
You can pass a series of objects as well.
There are 4 easing types; "in", "out",
"inOut" and "outIn".
"inOut" makes the tween accelerate in the first
half and decelerate in the second half.
"outIn" makes the tween decelerate in the first
half and accelerate in the second half.
Easing strength can take a value from 0 up to 100.
If no strength is passed, it defaults to 50.
And if no easing is needed at all, either of the following
examples is fine.
_x:[400] or _x:400
An example of the syntax with more parameters used would look
like:
myMC.dynTween ({duration : 40,
_x:[300, "outIn", 30], _y:100, _xscale:[200, "out"], _yscale:[-200, "inOut"],
_rotation:[720, "outIn"], _alpha:30, myProp1:[15, "in"], myProp2:-47,
callback : myFunc, cbArgs : {arg1 : 5, arg2 : "hello"}
},
{duration : 10},
{duration : 20, _x : 30}
);
callback is a function to pass, which you want the mc to execute
when the tween is done.
callback should be passed as a full string path to the function.
If the function which has called the dynTween method is passed
as callback, the series of the tweens will loop until the
reset method is called.
cbArgs is an object of parameters to pass to the callback
function. If there's only one parameter, it doesn't need to
be an object; just passing a value will be fine.
myProp1 and myProp2 in the example are user-defined variables
of myMC.
The values of them can tween too that way if necessary.
You can simultaneously tween as many properties as you want,
whether or not they are built-in, as long as their values
are "number".
And you can write a series of as many motion tweens as you
want in a single action.
They will be done one after another automatically.
You can also make the caller MC just pause by passing no
property arguments.
myMC.dynTween ({duration : 10});
This makes myMC pause for duration of 10 frames.
Below is a demonstration swf of dynTween MX.