I have a bunch of movieclips that are animated using TweenLite, (code below), but I would like to loop them 2 or 3 times continuously. I have put them inside of a function but can’t seem to get them to loop. The starting positions for each movieclip are defined before this function – an example below also.
Any ideas where I’m going wrong? S
private var F_Apricot:Fruit_Apricot;
F_Apricot = new Fruit_Apricot();
addChild(F_Apricot);
F_Apricot.x=222;
F_Apricot.y=-189;
F_Apricot.scaleX=0.7;
F_Apricot.scaleY=0.7;
setChildIndex(F_Apricot, 2);
function fruitLoop():void {
TweenLite.to(F_Passion, 1.7, {blurFilter:{blurX:8}, delay:1, x:277, y:325, scaleX:0.7, scaleY:0.7, rotation:28, ease:Cubic.easeOut});
TweenLite.to(F_Black1, 1.7, {blurFilter:{blurX:8}, delay:1.2, x:238, y:305, scaleX:0.5, scaleY:0.5, rotation:58, ease:Cubic.easeOut});
TweenLite.to(F_Apricot, 1.7, {blurFilter:{blurX:8}, delay:1.5, x:303, y:305, scaleX:0.7, scaleY:0.7, rotation:47, ease:Cubic.easeOut});
TweenLite.to(F_Raspberry, 1.7, {blurFilter:{blurX:8}, delay:1.6, x:207, y:305, scaleX:0.4, scaleY:0.4, rotation:18, ease:Cubic.easeOut});
TweenLite.to(F_Black2, 1.7, {blurFilter:{blurX:8}, delay:1.7, x:314, y:305, scaleX:0.5, scaleY:0.5, rotation:28, ease:Cubic.easeOut});
TweenLite.to(F_Cherries, 1.7, {blurFilter:{blurX:8}, delay:2.1, x:288, y:247, scaleX:0.6, scaleY:0.6, rotation:38, ease:Cubic.easeOut});
TweenLite.to(F_Black3, 1.7, {blurFilter:{blurX:8}, delay:2.3, x:323, y:305, scaleX:0.4, scaleY:0.4, rotation:-8, ease:Cubic.easeOut});
TweenLite.to(F_Lime, 1.7, {blurFilter:{blurX:8}, delay:2.4, x:208, y:305, scaleX:0.5, scaleY:0.5, rotation:28, ease:Cubic.easeOut});
TweenLite.to(F_Mango, 1.7, {blurFilter:{blurX:8}, delay:2.7, x:205, y:355, scaleX:0.7, scaleY:0.7, rotation:-38, ease:Cubic.easeOut});
TweenLite.to(F_Black4, 1.7, {blurFilter:{blurX:8}, delay:2.9, x:188, y:305, scaleX:0.5, scaleY:0.5, rotation:-8, ease:Cubic.easeOut});
TweenLite.to(F_Raspberry1, 1.7, {blurFilter:{blurX:8}, delay:3, x:303, y:305, scaleX:0.4, scaleY:0.4, rotation:-8, ease:Cubic.easeOut});
}
fruitLoop();
TweenLite has a parameter called onComplete which you can use to trigger your next loop.
http://www.greensock.com/as/docs/tween/_tweenlite.html