TweenLite random movement

Hey, Not too hot with AS3…

I am trying to animate dynamically added mc’s using tweenLite. I used senocular’s tutorial of attaching mc’s with random positioning and y position sorting. Now I am trying to animate each clip with a random x position but only the last clip loaded is animating to a random position and looping.

Heres my code, any pointers would be much appreciated. thanks:


import gs.TweenLite;
import fl.motion.easing.*;

// The number of chars to generate
var charCount:int = 50;

function createChars(numberOfChars:int):void {
    
    // variable to store chars created
    // in the loop
    var currChar:DisplayObject;
    
    // loop through the number of chars
    while(numberOfChars--){
        
        // randomly add a char either
        // as a bitmap or a movie clip
        if (Math.random() < .5) {
            
            // create a new Character instance
            currChar = new Character();
            
        }else{
        
            // create another char instance
            currChar = new Character2();
        }

        // add the char to the display list
        addChild(currChar);
        
        
        // position the new instance randomly on the screen
        currChar.x = Math.random() * (stage.stageWidth - currChar.width);
        currChar.y = Math.random() * (stage.stageHeight - currChar.height -300);
        
        
        //Tween lite stuff  *******
        
        function startTween():void {
            TweenLite.to(currChar,1 ,{x:Math.random()*700, onComplete:startTween});
        }
        
        startTween();


        //****************************
        
    }
}

// Create the chars
createChars(charCount);

// Arrange all children in the specified
// container based on their y value+
function sortChildrenByY(container:MovieClip):void {
    var i:int;
    var childList:Array = new Array();
    
    // first put all children in an array
    i = container.numChildren;
    while(i--){
        childList* = container.getChildAt(i);
        
    }
    
    // next, sort the array based on the
    // elements' y property
    childList.sortOn("y", Array.NUMERIC);
    
    // now match the arrangement of the array
    // with the arrangement of the display list
    i = container.numChildren;
    while(i--){
        
        // if the child at position i in the array
        // does not match the child at position
        // i in the display list, set that child
        // to the i position in the display list
        if (childList* != container.getChildAt(i)){
            container.setChildIndex(childList*, i);
        }
    }
}

// Arrange the chars
sortChildrenByY(this);