Probably doing this the hard way to begin with, but it was the only way I could figure out how to keep track of which QuadMotion was finishing its tween. I get the “Core object does not contain tween” error when the first object finishes its tween.
public function butterflyDone():void {
var checkNumber:int = 0;
for each(var t:QuadMotion in _butterflyTween) {
trace(t.percent);
if (t.percent >= 1) {
removeTween(t);
moveButterfly(checkNumber);
checkNumber++;
}
}
}
public function moveButterfly(actor:int):void {
//trace(actor);
_butterflyTween[actor] = new QuadMotion(butterflyDone);
var p:Vector.<Number> = new Vector.<Number>();
for (var loop:int = 0; loop < 6; loop++) {
p.push((Math.random() * _moveBorder) - _moveOffset);
}
_butterflyTween[actor].setMotion(_butterflyStart[actor].x, _butterflyStart[actor].y, p[2], p[3], p[4], p[5], (Math.random() * 2) + 2,Ease.quadInOut);
_butterflyTween[actor].object = _butterflyImages[actor];
addTween(_butterflyTween[actor], true);
_butterflyStart[actor] = new Point(p[4], p[5]);
}