Help required with looping through dynamically generated clips

Hi,

As part of a preloader, I’ve placed a blank movie clip on the stage and attached the following code:


onClipEvent (load) {
    for (i=0; i<50; i++) {
        ranx = Math.round(Math.random()*1000)+1;
        rany = Math.round(Math.random()*700)+1;
        var newBat:Object = attachMovie("flappingBat", "flappingBat"+i, i+1, {_x:ranx, _y:rany});
        var batArray:Array = new Array();
        batArray.push(newBat);
    }
}

onClipEvent (enterFrame) {
    for (var i = 0; i<=batArray.length-1; i++) {

        batArray*.acceleration = Math.round((Math.random()*10));
        
ranx = Math.round((Math.random()*100));
            rany = Math.round((Math.random()*100));

this.onEnterFrame = function() {
            batArray*._x += ((ranx-batArray*._x)/acceleration);
            batArray*._y += ((rany-batArray*._y)/acceleration);
            
            }
        }
    }
}

The bats generate fine, but I can’t get them to move about. I’ve been looking at this for hours, and just had the array idea, but I’ve missed something.

Please help.

Thanks,
Andy