Hello.
Say i’ve got multiple clips on stage and i want to move them all say 20pixels to the right. I want to do this with one Tween and have a nice elegant mathematical solution (i don’t want to have to take position stamps etc etc unless its absolutely necessary). Here’s an example. 4 clips randomly dragged on the stage and put in an array, Then one tween to move them all (for performance reasons):
import mx.transitions.Tween;
import mx.transitions.easing.*;
var disTraveled = 0
var ball_array = new Array(ball0_mc, ball1_mc, ball2_mc, ball3_mc)
var obj = new Object()
obj.x = 20
var xTween = new Tween(obj, "x", Regular.easeOut, obj.x, 0, 20)
xTween.addListener(this)
function onMotionChanged(event:Object):Void
{
var it = ball_array.length
for (var i=0; i < it; i++)
{
ball_array*._x += obj.x
}
disTraveled += obj.x
}
function onMotionFinished(event:Object):Void
{
trace(disTraveled)
}
obviously this code doesn’t work as it is iteratively adding the value of obj.x (not the val - prev val to get the difference). There must be a nice solution to this and wandered if anyone had come accross this problem before
cheers
jimmy