Loader / Array / Transfer of variable


for(var i:Number=0; i<amount; i++)
{
    work = new WorkSlot();
    imgArray.push(work);    
    addChild (imgArray*);

    var posY:Number =  (i * imgArray*.height) + (i * my_thumb_distance);
    imgArray*.y = posY;
    imgArray*.preloader.visible = true;
    
    imgArrayLoader.push (new Loader);

    imgArrayLoader*.load(new URLRequest("content_"+i+".swf"));
    
    imgArrayLoader*.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
    imgArrayLoader*.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
    
    //imgArray*.mcLoader.addChild(imgArrayLoader*); // var "i" only works inside the for-loop
}

function imageLoaded(e:Event):void {
    imgArray[[COLOR=Red]i[/COLOR]].mcLoader.addChild(imgArrayLoader[[COLOR=Red]i[/COLOR]]);
    imgArray[[COLOR=Red]i[/COLOR]].preloader.visible = false;
}

function imageLoading(e:ProgressEvent):void {
    // Get current download progress
    var loaded:Number = e.bytesLoaded / e.bytesTotal;
    var percent = Math.round(e.bytesLoaded / e.bytesTotal*100);
    imgArray[[COLOR=Red]i[/COLOR]].preloader.txt.text = percent;
    // Send progress info to "preloader" movie clip
    imgArray[[COLOR=Red]i[/COLOR]].preloader.SetProgress(loaded);
}

the created movieclips “imgArray*” could be adressed by using this name and a number. “imgArray[2].width” refers to the third object (0,1,2,…). for example it’s important to arrange all these container objects on stage. so far, so good!

inside every container-object “imgArray” is a “preloader” located…
working with the “contentLoaderInfo” is a problem. how is it possible to connect the content of the different “imgArray”-instances (0,1,2,…) with their preloader?

i marked the “i” in red. an error occurs because the “i” is unknown (only known inside the for-loop). exist any chance to use “e.currentTarget” or “e.target.loader”?

thanks for suggestions!