# Help with image Gallery creation.Please Help me!

**URL:** <https://forum.kirupa.com/t/help-with-image-gallery-creation-please-help-me/254037>\
**Category:** flash\
**Created:** [March 7, 2008, 1:03pm UTC](https://forum.kirupa.com/t/help-with-image-gallery-creation-please-help-me/254037 "2008-03-07T13:03:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecptavares](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@ecptavares](https://forum.kirupa.com/u/ecptavares)\
**Post date:** [March 7, 2008, 1:03pm UTC](https://forum.kirupa.com/t/help-with-image-gallery-creation-please-help-me/254037/1 "2008-03-07T13:03:15Z")

</div>

Hi!  
I want t make a row of images that I am loading from a xml file. But I am struggling at the begining.I want to load each image into an empty MC and load this whole MC of images into another MC so I can scroll it.

Here is my code so far:

```auto

package
{
   import flash.display.Loader;
   import flash.display.MovieClip;
   import flash.events.Event;
   import flash.events.EventDispatcher;
   import flash.net.URLLoader;
   import flash.net.URLRequest;
   
   public class teste extends MovieClip
   {
      var picXML : XML;
      var xmlLoader : URLLoader = new URLLoader();
      var thumbs : Array = new Array();
      var numImgs : Number;
      var holder : MovieClip = new MovieClip();
      var imgLoader : Loader = new Loader();
      var mcImg : MovieClip;
      
      public function teste()
      {
         init();
      }
      
      private function init():void
      {
          xmlLoader.load(new URLRequest("album.xml"));
         xmlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
      }
      
      private function onXMLLoaded(event:Event):void
      {
        picXML = new XML(event.target.data);   
        var picList : XMLList = picXML.pic.attribute("url");
        
        for each(var pl : XML in picList)
        {
           thumbs.push(pl);
        }
        
        numImgs = thumbs.length;
        
        buildThumbs();
      }
      
//here is where starts my pain. I am getting an error and if I comment out the line imgLoader.load(...) I dont get the error message.
      private function buildThumbs():void
      {
         for(var i = 0;i <= numImgs;i++)
         {
            mcImg = new MovieClip();
            mcImg.name = "img" + i;
            
            imgLoader.load(new URLRequest(thumbs*));
            
            mcImg.addChild(imgLoader);
            holder.addChild(mcImg);
         }
         
      }
      
   }
}

```

another question is how I set the x and y position of each imgMC inside the holder MC?

Here is what I get when I teste my fla that has this code : var s : teste = new teste(); addChild(s);

> 

TypeError: Error #2007: Parameter url must be non-null.  
at flash.display::Loader/flash.display:Loader::\_load()  
at flash.display::Loader/load()  
at teste/::buildThumbs()  
at teste/::onXMLLoaded()  
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()  
at flash.events::EventDispatcher/dispatchEvent()  
at [flash.net](http://flash.net)::URLLoader/flash.net:URLLoader::onComplete()
