7 Replies Latest reply on Mar 25, 2007 9:16 PM by kglad

# Random Tween Effect(type)  - is it possible??

HI All
I have some 50 mc's on stage, and wondered if its possible to have the motion (e.g _x,_y,_alpha) be random.
For example:
==============
import mx.transitions.Tween;
import mx.transitions.easing.*;
var Eq = [mx.transitions.easing.Back.easeIn, mx.transitions.easing.Back.easeOut, mx.transitions.easing.Back.easeInOut, mx.transitions.easing.Bounce.easeIn, mx.transitions.easing.Bounce.easeOut, mx.transitions.easing.Bounce.easeInOut, mx.transitions.easing.Elastic.easeIn, mx.transitions.easing.Elastic.easeOut, mx.transitions.easing.Elastic.easeInOut, mx.transitions.easing.Regular.easeIn, mx.transitions.easing.Regular.easeOut, mx.transitions.easing.Regular.easeInOut, mx.transitions.easing.Strong.easeIn, mx.transitions.easing.Strong.easeOut, mx.transitions.easing.Strong.easeInOut, mx.transitions.easing.None.easeIn, mx.transitions.easing.None.easeOut, mx.transitions.easing.None.easeInOut];

new Tween(target_mc, "_x", Eq[Math.random()*18), x1, x2, t, true);

Is there any reason i could not have this?? (i just cant seem to get it to work. :-(

It makes the whole project seem more organic having a random effect rather then fixing the tween as
"new Tween(target_mc, "_x", Regular.easeOut, x1, x2, t, true);"

-Regards
Craig
try:

• ###### 2. Re: Random Tween Effect(type)  - is it possible??
no such luck
the tween appears to ignore the result (Eq[Math.floor(Math.random()*18)]) and default back to something like . .
...."_x", None.easeInOut, x1,....

Even if i put something like:
var easeType = Eq[Math.floor(Math.random()*18)]
It still just ignores me :-(

Hmmm
-C

• ###### 3. Re: Random Tween Effect(type)  - is it possible??
have you defined x1, x2 and t?
• ###### 4. Re: Random Tween Effect(type)  - is it possible??
yes :-)
===========
• ###### 5. Re: Random Tween Effect(type)  - is it possible??
create a new fla (550 x 450 or thereabouts) with a movieclip on stage with instance name mc1. paste the code below in the first frame. what happens when you click your movieclip?

• ###### 6. Re: Random Tween Effect(type)  - is it possible??
Cheers
Will try that shortly :-)
• ###### 7. Re: Random Tween Effect(type)  - is it possible??
ok.