Hello,

I have dozen movieclips in library which I want to attach and load dinamicaly. For this task I decided to attach them using for loop. Also I use caurina transitions to fade them in and out of stage. My problem is, that I want to loop them infinitely. To do that I put oll the code inside a function, and on the last movieclip that is coming on stage I put oncomplete function. Here is my code:

Actionscript Code:
startTween1 = function() {

for (i=1;i<16;i++){
    _root.attachMovie("mc_txt"+i, "mc_txt"+i, i, {_x:150, _y:18});
    _root["mc_txt"+i]._alpha = 0;
   
    Tweener.addTween(_root["mc_txt"+i], {_alpha:100, time:0.5, _x:15, delay:(i-1)*4.3, transition:"easeOutExpo" });
   
    Tweener.addTween(_root["mc_txt"+i], {_alpha:0, time:0.5, _x:150, delay:(i-1)*4.3+4, transition:"easeInOutBack" });
   
    }

_root.attachMovie("mc_txt16", "mc_txt16", 999, {_x:150, _y:10});
mc_txt6._alpha = 0;
Tweener.addTween(mc_txt6, {_alpha:100, time:0.5, _x:3, delay:22 });
    Tweener.addTween(mc_txt6, {_alpha:0, time:0.5, _x:-150, delay:25.5, onComplete:startTween1});
}

startTween1();

So, on the last movieclip (mc_txt16) I use this function onComplete:startTween1 to loop all the code infinitely. This works ok, but maybe there is a better solution for this? I've just searched this forum to find something like onCompleteselect the last movieclip in the for loop and then start startTween1 function) instead of adding several code lines that do the same as the for loop above.

Thanks...