# Pass arguments to onLoadInit

**URL:** <https://forum.kirupa.com/t/pass-arguments-to-onloadinit/197452>\
**Category:** flash\
**Created:** [August 16, 2006, 2:46pm UTC](https://forum.kirupa.com/t/pass-arguments-to-onloadinit/197452 "2006-08-16T14:46:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blitzer](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blitzer/32/2717_2.png) [@Blitzer](https://forum.kirupa.com/u/Blitzer)\
**Post date:** [August 16, 2006, 2:46pm UTC](https://forum.kirupa.com/t/pass-arguments-to-onloadinit/197452/1 "2006-08-16T14:46:32Z")

</div>

Hey folks. Long time lurker here, but my first post 🙂

I´m trying to build a function to preload and show a couple of images from an array.

```auto

loadListener.onLoadInit=function(){
    //preload next image from the array
    }

function preloadImages(loadArray:Array,startNum:Number):Void{

    if(startNum < numSlides){
    attachMovie("holder","holder"+startNum,this.getNextHighestDepth());
    myMCL.loadClip(loadArray[startNum],this["holder"+startNum]);
    startNum++;
    }else{
    trace("all images loaded");
    }
}

preloadImages(pathArray,0);

```

So, once the onLoadInit is invoked, I want to call preloadImages() again, and load the next image in the array. The problem I´m having is to pass the variables startNum (wich is the index) and loadArray (the array with paths to the images) to the onLoadInit function, and then further to the preloadImages() again. Any ideas on how I can solve this?
