# Loading Multiple Images, Same Time, w/ 1 Loader?

**URL:** https://forum.kirupa.com/t/loading-multiple-images-same-time-w-1-loader/319420
**Category:** flash
**Created:** [February 20, 2011, 6:03am UTC](https://forum.kirupa.com/t/loading-multiple-images-same-time-w-1-loader/319420 "2011-02-20T06:03:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![megshea](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@megshea](https://forum.kirupa.com/u/megshea)
#### Post date: [February 20, 2011, 6:03am UTC](https://forum.kirupa.com/t/loading-multiple-images-same-time-w-1-loader/319420/1 "2011-02-20T06:03:16Z")

</div>

My need is to load 4 images at one time, and I’d like to have the code in a function that could load them one after another. But all I am getting is the last one of the loop iteration - I know it due to needing an onComplete, but I can’t figure out how to make it all work passing it back and forth).

```
 My best guess is below. If you could , please advise on how best to do this. After coding all day I am dazed and confused :) 

```

```auto

function loadThumbnails()
{

    for (var i:int = 1; i < 4; i++)
    {
        
        imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus);
        imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function onCompleteStatus(e:Event) { displayImage(e, new Array("1"))});
        var urlRequest:URLRequest = new URLRequest(xmlData[showNumber]["s" + i + "_thumb"]);
        imgLoader.load(urlRequest);

    }
}

function onProgressStatus(e:ProgressEvent)
{
    // this is where progress will be monitored     
    trace("...PROGRESS STATUS...");
}

function displayImage(e:Event, arg:Array)
{
  
    Object(this)["tmbBox" + arg[0] + "_mc"]["tmbHolder" + arg[0] + "_mc"].addChild(imgLoader);   
}

```
