# MovieClipLoader loop problems

**URL:** <https://forum.kirupa.com/t/moviecliploader-loop-problems/307067>\
**Category:** flash\
**Created:** [March 27, 2010, 12:27pm UTC](https://forum.kirupa.com/t/moviecliploader-loop-problems/307067 "2010-03-27T12:27:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anfractuosities](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anfractuosities](https://forum.kirupa.com/u/anfractuosities)\
**Post date:** [March 27, 2010, 12:27pm UTC](https://forum.kirupa.com/t/moviecliploader-loop-problems/307067/1 "2010-03-27T12:27:55Z")

</div>

Hello,

I am trying to load a group of thumbnails using Moviecliploader within a class function. Only the last image is loaded onto the stage.

can anyone point me in the right direction, I have been wrestling with this for a couple of days.

I have tried it with a single loader…  
loaders created in the loop, stored in an array…  
and loaders as a child of the dynamically created image+x clip  
(ie. \_level0.Gallery.image1.image & \_level0.Gallery.image1.mcLoader)

Here is the class…sorry about the sloppy formatting, I just spent 15 min trying to make it look ok in this little window…looks fine in flash. 🙂

```auto
&#65279;
import classestwo.GalleryList;
import classestwo.Image;

class classestwo.Gallery extends MovieClip{
 private var myXML:XML;
 static public var InfoVars:Array = new Array('filename','title','medium','size','year','price','thumbwidth','thumbheight','type');

 public function Gallery(GLIST:GalleryList, NUM:Number){
    var thisObj:Gallery = this;
    var GXML:XML=new XML();
    var image:MovieClip;
    var mcLoader:MovieClipLoader = new MovieClipLoader;
    var mcListener:Object=new Object;
    var activeImage;
    var laoders:Array = new Array();
        
    GXML.ignoreWhite=true;        
    GXML.load("xmls/" +GLIST.Name(NUM) + ".xml");        
    GXML.onLoad = function(success:Boolean){
        if (success){            
      thisObj.myXML=this;        
      var thisGalleryName:String=GLIST.Name(NUM);
      var LENGTH:Number=this.firstChild.childNodes.length;                    
      _root.createEmptyMovieClip(thisGalleryName, this.getNextHighestDepth);
         for(var x=0; x<LENGTH; ++x){                    
           var ImageInst:String = "image"+x;                        
           //create empty movieclip for gallery                                        
          _root[thisGalleryName].createEmptyMovieClip(ImageInst, thisObj.getNextHighestDepth());    
           activeImage=_root[thisGalleryName][ImageInst];
           for(var i=0; i<InfoVars.length;++i){
        //declare and Set vars for image info activeImage[InfoVars*]=this.firstChild.childNodes[x].childNodes*.firstChild; 
        }
    //Load image                    
    var thumbPath:String = "galleries/" + thisGalleryName + "/thumbs/";
    var imgPath:String = thumbPath + activeImage.filename;
    //create empty movie clip inside each image called image

       activeImage.createEmptyMovieClip("image", this.getNextHighestDepth());
       mcLoader.addListener(mcListener);            
       mcLoader.loadClip(imgPath, activeImage.image);
       activeImage._x+=5*x;
       mcListener.onLoadStart=function(mc:MovieClip){
       trace("STARTING ::: " + mc);
    }                    
}
            }
            else{trace("ERROR GalleryList Class");}
        }
    }    

}

```
