contentLoaderInfo problems

Hey all, I’m having trouble with loading external .jpgs in actionscript 3 and having it attach data from an XML file that I’m working with, I have racked my brain and am totally out of answers. Here’s the problem; the script runs fine, but when it draws the bitmaps from the external file it changes the order in the display while the text remains in the correct order, I can’t explain this, it just happens. I haven’t figured out a way to send a variable along with the Loader.load() function so that it loads the text at the same time instead of re-running a loop, causing it to load the text and file at different times. I think this would solve the problem, but I’m too new at AS3 to figure it out. Any ideas?

Thanks, here’s the script:

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
var url:URLRequest;
var fileURL:String;
var fileText:String;
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest(“cases.xml”));
var imageCounter:Number;

function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
imageCounter = xmlData.image.length()
for (var j:Number = 0; j < imageCounter ; j++){

	//////////////////////////////////////
	// HERE IS THE IMAGE LOADER PORTION //
	//////////////////////////////////////
	
	fileURL = xmlData.image.attribute("file")[j];
	fileText = xmlData.image.attribute("texter")[j];
	var externalLdr:Loader = new Loader();
	externalLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, createImageHolders);

	url = new URLRequest(fileURL);
	externalLdr.load(url);
	
}

}

var container :Sprite;
var scene :MovieScene3D;
var camera :FreeCamera3D;
var plane :Plane;
var planeZArray:Array = new Array();
var planes:Array = new Array();

container = new Sprite;
addChild( container );

container.x = stage.stageWidth*.5;
container.y = stage.stageHeight*.5;

scene = new MovieScene3D(container);
camera = new FreeCamera3D();
camera.z = 250;
camera.y = 100
camera.rotationY = -180

var i:Number = -1;
var q:Number = 0;

function createImageHolders (e:Event) {
var realOne:MovieClip = new MovieClip();
realOne.name = “realOne”+q;
var orig:MovieClip = new MovieClip();
realOne.addChild(orig);
orig.x = 20;
orig.y = 20;
orig.addChild(e.target.loader);

//////////////////////////////
// HERE IS THE TEXT PORTION //
//////////////////////////////

var tx:TextField = new TextField();
tx.multiline = true;
tx.wordWrap = true;
tx.x = 20;
tx.y = orig.height + 20;
tx.width = 100;
tx.name = "texter";
fileText = xmlData.image.attribute("texter")[q];
tx.htmlText = fileText;	
realOne.addChild(tx);

var myBlock = new block;
myBlock.name = "blockee";
realOne.addChildAt(myBlock,0);

var bam:MovieMaterial = new MovieMaterial(realOne);

i++;

plane = new Plane(bam,realOne.width,realOne.height,10,10);
plane.material.doubleSided = true;
scene.addChild(plane,"p"+i) ;
plane.container.name = "p"+i;
plane.container.buttonMode = true;
plane.container.addEventListener(MouseEvent.CLICK, onClick);
plane.x  = i*80;
plane.y  = 0;
plane.z  = 50-i;
plane.name = i.toString();
planeZArray* = plane.z;
planes.push(plane);
plane.rotationY = -130;


if((i+1) == imageCounter){
	planes[0].container.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false)); 
}

q++;

}