# Images not loading in order

**URL:** <https://forum.kirupa.com/t/images-not-loading-in-order/249218>\
**Category:** Uncategorized\
**Created:** [January 16, 2008, 4:52pm UTC](https://forum.kirupa.com/t/images-not-loading-in-order/249218 "2008-01-16T16:52:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benny\_hill](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@benny\_hill](https://forum.kirupa.com/u/benny_hill)\
**Post date:** [January 16, 2008, 4:52pm UTC](https://forum.kirupa.com/t/images-not-loading-in-order/249218/1 "2008-01-16T16:52:22Z")

</div>

trying to make a dead simple slideshow. The code I got works but it does not load the images in order of how they are named (i.e image0.jpg, image1.jpg, etc.)

```auto

import fl.transitions.easing.*;
import fl.transitions.*;
var imgArray:Array = new Array();
var loader:Loader;
var timer:Timer = new Timer(5000);
var count:int = 0;
var numImages:int = 5;
for(var i:Number=0; i<numImages; i++){
 loader = new Loader();
 loader.load(new URLRequest("factImages/image"+i+".jpg"));
 loader.contentLoaderInfo.addEventListener(Event.COMPLETE, pushImage);
}
function pushImage(e:Event):void{
 var holder:MovieClip = new MovieClip();
 holder.addChild(e.target.content);
 imgArray.push(holder);
 
 if (imgArray.length == 5){
  startShow();
 }
}
function startShow():void{
 //add initial image
 addChild(imgArray[0]);
 inTrans(imgArray[0]);
 count = 1;
 
 timer.addEventListener(TimerEvent.TIMER, slideShow);
 timer.start();
}
function slideShow(event:TimerEvent):void{
 addChild(imgArray[count]);
 inTrans(imgArray[count]);
 count++;
 
 //reset counter
 if(count == 5){count = 0};
 
 if(numChildren > 2){
  removeChild(getChildAt(0));
 }
}
function inTrans(mc:MovieClip):void{
 var myTransitionManager:TransitionManager = new TransitionManager(mc);
 myTransitionManager.startTransition({type:Wipe, direction:Transition.IN, duration:2, easing:Strong.easeOut});
 var fadeIn:TransitionManager = new TransitionManager(mc);
 fadeIn.startTransition({type:Fade, direction:Transition.IN, duration:3, easing:Strong.easeOut});
}

```

any clues on how to force the images to be loaded by their filename order?  
I do not want to use XML for a 5 image slideshow.

I tried renaming the images but the order still gets jumbled (i.e image3, image1, image4, image2, image0)
