Pass arguments to onLoadInit

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

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


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?