# Help with onLoadInit

**URL:** <https://forum.kirupa.com/t/help-with-onloadinit/273155>\
**Category:** Uncategorized\
**Created:** [October 12, 2008, 10:19am UTC](https://forum.kirupa.com/t/help-with-onloadinit/273155 "2008-10-12T10:19:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivant](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sivant](https://forum.kirupa.com/u/sivant)\
**Post date:** [October 12, 2008, 10:19am UTC](https://forum.kirupa.com/t/help-with-onloadinit/273155/1 "2008-10-12T10:19:36Z")

</div>

i have a dynamic gallery that loads thumbnails and big pictures with XML.  
i need all the thumbnails to load before but not the big pictures so i made two **for loops** and only for the thumbnail loop i am using MovieClipLoader ,addListener and loadClip like this:

```auto

loderFun = function (currentCat) {
 currentCatMain = currentCat;
 for (i=0; i<this["path_thNmame"+currentCat].length; i++) {
  this.thumbs.createEmptyMovieClip("holder_mc"+i, this.thumbs.getNextHighestDepth());
  this.thumbs["loader"+i] = new MovieClipLoader();
  this.thumbs["loader"+i].addListener(this);
  this.thumbs["loader"+i].loadClip(this["path_thNmame"+currentCat]*, this.thumbs["holder_mc"+i]);
 }
 for (m=0; m<this["path_bpName"+currentCat].length; m++) {
  this.createEmptyMovieClip("tempMc"+m, this.getNextHighestDepth());
  _root["tempMc"+m].loadMovie(_root["path_bpName"+currentCat][m]);
  _root["tempMc"+m]._alpha = 0;
 
 }
function onLoadInit(i) {
 loadedImages++;
 m = i._name;
 m = m.slice(9, 11);
 holderHeight = this.thumbs["holder_mc"+m]._height;
 this.thumbs["holder_mc"+m]._y = thumbsHeight;
 thumbsHeight += holderHeight+4;
 if (loadedImages == this["path_thNmame"+currentCatMain].length) {
  play();
 }
}
};

```

i am not sure if this is the right way to use the onLoadInit and i am afaraid it will make problems that i cant see now . can i have some feed back for this? i want to add a preloader aswell…also if i understand correct i can have only one onLoadInit ?
