No need to use a Timer. Wouldn't it be as simple as this?:
var targets:Array = [mc1, mc2, mc3];
var positions:Array = [0, 100, 200];
var stagger:Number = 0.2;
for (var i:int = 0; i < targets.length; i++) {
TweenMax.to(targets[i], 1, {y:positions[i], delay:i * stagger});
}
If you need to control the entire sequence as a whole (pause(), resume(),
reverse(), restart(), gotoAndPlay(), etc.), definitely insert() them into a
TimelineLite or TimelineMax. If you aren't familiar with TimelineLite/Max,
check out the brief video at http://www.greensock.com/timeline-basics/. But
again, a simple loop along with the delay special property should be all you
need for most situations.
Jack
-----Original Message-----
From: Merrill, Jason [mailto:[email protected]]
Sent: Thursday, September 09, 2010 1:43 PM
To: Flash Coders List
Subject: [Flashcoders] TweenMax.allTo()
So in Greensock's TweenMax, you can tween and stagger (delay) the tweens
of multiple sprites at once, via giving a method like, "allTo" an array
of objects (in this example, _blockViews):
TweenMax.allTo(_blockViews, 1, { alpha:1, y:150 }, .2);
However, this assumes you want all the tweens to tween to the same
property value. What if I wanted all the objects to end up at various Y
locations instead of 150? As it is in the code above, they all tween to
y=150. Is there a way to provide an array of y locations that each
object moves to and have then staggered (as you can with the allTo()
method)?
I can of course accomplish this by writing some Timer event code to
tween each object individually and accomplish what I want - ending up at
varying Y locations, but I'd rather not have to write all that code -
shouldn't there be a way to do this with TweenMax's sequencing
capabilities? Would this be a case where you would use TimelineMax and
append several tweens? If so, how would you also stagger them?
Jason Merrill
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders