# Images Loaded from XML Load in Wrong Order (On Stage)

**URL:** <https://forum.kirupa.com/t/images-loaded-from-xml-load-in-wrong-order-on-stage/299499>\
**Category:** flash\
**Created:** [November 5, 2009, 8:04pm UTC](https://forum.kirupa.com/t/images-loaded-from-xml-load-in-wrong-order-on-stage/299499 "2009-11-05T20:04:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matius](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@matius](https://forum.kirupa.com/u/matius)\
**Post date:** [November 5, 2009, 8:04pm UTC](https://forum.kirupa.com/t/images-loaded-from-xml-load-in-wrong-order-on-stage/299499/1 "2009-11-05T20:04:27Z")

</div>

The images are to go from 1 - 20 … Left to Right on stage. The images are named image\_1 - 20 and everything is right as far as that’s concerned.

Will images load according to their size before XML order? I’m loading multiple images from XML like so:

```auto

XML...

function formatXMLContent():void {
    for (var i:int = 0; i < tourID.length(); i++) {            
        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
        loader.load(new URLRequest(tourImage*));        
    
        box = new Sprite();
        box.graphics.beginFill(0x000000, 0);
        box.graphics.drawRect(0, 0, 310, 340);
        box.graphics.endFill();
        box.x = i * (box.width - 45);
        boxes.push(box);
        content_mc.addChild(box);
        
        mapHotSpot = new MapHotSpot();
        mapHotSpot.buttonMode = true;
        mapHotSpot.useHandCursor = true;
        mapHotSpot.x = 225;
        mapHotSpot.y = 288;
        MakeLink.Link(mapHotSpot, tourLink*, "_blank");
        box.addChild(mapHotSpot);
    }
}

function imageLoaded(e:Event):void {
    var image:Bitmap = (Bitmap)(e.target.content);
    var holder = boxes[loadedImages];    
    **holder**.addChild(image);
    loadedImages++;
}    

```

If I trace loadedImages or holder, etc… they trace in the RIGHT order.

Why not on screen?

Thank you for my sanity.
