Dynamic mc and eventlisteners

I am creating a small image gallery and I am creating the actual images dynamically.

The images are stored via json and I am listing them underneath each other. No I can get all to work and they all load and position each other correctly underneath.

What I would like to do is assign each image a addEventListener so that when clicked they pass the necessary details onto another function which will then display a larger image simple and basic but I am having trouble with adding the eventlistener.

each one gets an eventlistener to it but when clicking on each one they all show the details from the last one.

The code is attached to the main gallery container is as follows:


private function displayThumbs(e:Event):void
			{
				trace("GALLERY CONTAINER: Display Thumbs");
				var loader:URLLoader = URLLoader(e.target);
				var galImages:Array = JSON.decode(loader.data);
				var imgLen:Number = galImages.length;
				var imgThumb:Array = new Array();
				var thumbCont:MovieClip = new MovieClip();
				
				for (var i=0; i<imgLen; i++){
					imageLoader = new Loader();
					imageLoader.load(new URLRequest(galImages*.theImg));
					
					imageLoader.x=imgThumbXpos;
					imageLoader.y=imgThumbYpos;
					thumbCont.name = "thumb"+i;
					imgThumb* = thumbCont;
					imageGallery.addChild(imgThumb*);
					imgThumb*.addChild(imageLoader);
					
					imgThumb*.buttonMode = true;
					imgThumb*.addEventListener(MouseEvent.CLICK, thumbClick);
					imgThumbYpos=imgThumbYpos+80;
				} //-- end loop
				
			}
			
			
			private function thumbClick(e:MouseEvent):void
			{
				trace(e.currentTarget.name);
			}

Basically I want each image when clicked to pass its details to the click event. But all I get is the last name set