Skip to main content
Participant
March 25, 2007
Question

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

  • March 25, 2007
  • 4 replies
  • 547 views
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:
say i had
==============
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];

and then i had
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
This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
March 26, 2007
ok.
Participant
March 26, 2007
Cheers
Will try that shortly :-)
kglad
Community Expert
Community Expert
March 25, 2007
have you defined x1, x2 and t?
Participant
March 26, 2007
yes :-)
===========
kglad
Community Expert
Community Expert
March 26, 2007
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?

kglad
Community Expert
Community Expert
March 25, 2007
try:

Participant
March 25, 2007
kglad
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