# Loading Images into MCs

**URL:** <https://forum.kirupa.com/t/loading-images-into-mcs/291238>\
**Category:** flash\
**Created:** [June 26, 2009, 4:31pm UTC](https://forum.kirupa.com/t/loading-images-into-mcs/291238 "2009-06-26T16:31:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick23](https://avatars.discourse-cdn.com/v4/letter/n/76d3ee/32.png) [@Nick23](https://forum.kirupa.com/u/Nick23)\
**Post date:** [June 26, 2009, 4:31pm UTC](https://forum.kirupa.com/t/loading-images-into-mcs/291238/1 "2009-06-26T16:31:18Z")

</div>

Hello,  
I am trying to load images and when the loading is complete I want to make each image a separate Movie Clip for further manipulation. I have the loading code down, but when I have more than one image only the last image loaded is shown and the first image is nowhere to be found.

Here’s the code:

```auto
function loadImage(url:String):void{
    preloader.visible = true;
    
    imageLoader = new Loader();
    imageLoader.load(new URLRequest(url));
    imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
    imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
    imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, imageNotFound);
}

function imageNotFound(e:IOErrorEvent){
    trace("Image not found.");
    preloader.percentage.text = "File not found.";
}

function imageLoading(e:ProgressEvent){
    var loaded = e.bytesLoaded / e.bytesTotal;
    preloader.SetProgress(loaded);
}

function imageLoaded(e:Event){
    numImages += 1;
    **var pic = imagesArray[numImages] = imageParent.addChild(imageLoader); //this part is what I need help with**
    pic.x = (windowWidth-275)/2;
    pic.y = 28;
    pic.alpha = 0;
    preloader.visible = false;
}

```

i think it has something to do with the fact that I am not using the new function somewhere, but I do not know how to use that in the code to make it work.  
(Here’s the tutorial I’m expanding on: [http://www.kirupa.com/developer/flashcs3/preloader\_as3\_pg1.htm](http://www.kirupa.com/developer/flashcs3/preloader_as3_pg1.htm) )  
Thanks!
