# Help creating Image Gallery

**URL:** <https://forum.kirupa.com/t/help-creating-image-gallery/256480>\
**Category:** flash\
**Created:** [April 3, 2008, 1:58pm UTC](https://forum.kirupa.com/t/help-creating-image-gallery/256480 "2008-04-03T13:58:24Z")\
**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:** [April 3, 2008, 1:58pm UTC](https://forum.kirupa.com/t/help-creating-image-gallery/256480/1 "2008-04-03T13:58:24Z")

</div>

Hi!

I am trying to make an image gallery and I cant load the images from a XML file into MCs.

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 picList : XMLList = new XMLList();
		var xmlLoader : URLLoader = new URLLoader();
		var imgLoader : Loader = new Loader();		
		var thumbs : Array = new Array();		
		var numImgs : Number;
		var holder : MovieClip = new MovieClip();
		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);	
		  picList = picXML.pic.attribute("url");

		  for each(var pl : XML in picList)
		  {
			  thumbs.push(pl);
		  }

		  numImgs = thumbs.length;

		  buildThumbs();
		}
		
		private function buildThumbs():void
		{			
			for(var i = 0;i <= numImgs;i++)
			{
				imgLoader.load(new URLRequest(thumbs*));
				imgLoader.addEventListener(Event.COMPLETE,onImgLoaded);				
			}
			
		}

		function onImgLoaded(event:Event):void
		{
			mcImg.addChild(imgLoader);
			holder.addChild(mcImg);
		}
		
	}
}

```

And Here is the error message I get when I test the movie.

> 

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()

And here is my FLA file:

```auto

var s : teste = new teste();
addChild(s);

```
