# Load and store images in array

**URL:** <https://forum.kirupa.com/t/load-and-store-images-in-array/300064>\
**Category:** flash\
**Created:** [November 15, 2009, 7:09pm UTC](https://forum.kirupa.com/t/load-and-store-images-in-array/300064 "2009-11-15T19:09:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalseide](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@dalseide](https://forum.kirupa.com/u/dalseide)\
**Post date:** [November 15, 2009, 7:09pm UTC](https://forum.kirupa.com/t/load-and-store-images-in-array/300064/1 "2009-11-15T19:09:24Z")

</div>

Hi, I’m creating a portfolio for my self.  
I’m going to show a bunch of images in a slideshow.  
Since everybody hate waiting for things to load, I thought it would be a good idea to load all the images in the background while the user is clicking on other things.

- user enters page  
– design and menues are loaded  
— the page is showed to the user  
---- images used in other parts of the flash-site is loading “behind the scenes”.

When the user finally open the slideshow, he/she don’t have to wait for the images to load.

This is my code:

```auto

function downloadImages(i:uint = 0) {
    trace("- Downloading portfolio images");
    loading();
    function loading() {
        _loader = new Loader();
        _loader.load(new URLRequest("http://urlstosite"+_imageURLS[i]));
        _loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingProgress);
        _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, storeImage);
    }
    
    function storeImage(e:Event):void {
        _image.push(_loader);
        i++
        if (i < _imageURLS.length()) {
            trace("image nr:"+i+" downloaded");
            loading();
        } else {
            trace(" - Images are downloaded");
        }
    }
}

```

In this case \_image is an array. I’ve also tried to make it a sprite and used the addChild.  
In both tries I get Error #1006: value is not a function.
