# Urgent Help with Image Gallery

**URL:** <https://forum.kirupa.com/t/urgent-help-with-image-gallery/322176>\
**Category:** flash\
**Created:** [May 13, 2011, 12:10am UTC](https://forum.kirupa.com/t/urgent-help-with-image-gallery/322176 "2011-05-13T00:10:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennyg3011](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@jennyg3011](https://forum.kirupa.com/u/jennyg3011)\
**Post date:** [May 13, 2011, 12:10am UTC](https://forum.kirupa.com/t/urgent-help-with-image-gallery/322176/1 "2011-05-13T00:10:18Z")

</div>

Hi,

I really need help with an image gallery i have created. Cannot think of a resolution

So…I have a dynamic image gallery that pulls the pics into a movie clip and adds them to the container (slider)

The issue i am having is that when i click on this i am essentially clicking on all the items collectively and i would like to be able to click on each image seperately…

Please see code below

var xml:XML;  
var images:Array = new Array();  
var totalImages:Number;  
var nbDisplayed:Number = 1;  
var imagesLoaded:int = 0;  
var slideTo:Number = 0;  
var imageWidth = 150;  
var titles:Array = new Array();

var container\_mc:MovieClip = new MovieClip();  
slider\_mc.addChild(container\_mc);  
container\_mc.mask = slider\_mc.mask\_mc;  
function loadXML(file:String):void{  
var xmlLoader:URLLoader = new URLLoader();  
xmlLoader.load(new URLRequest(file));  
xmlLoader.addEventListener(Event.COMPLETE, parseXML);  
}

function parseXML(e:Event):void{  
xml = new XML(e.target.data);  
totalImages = xml.children().length();  
loadImages();  
}

function loadImages():void{  
for(var i:int = 0; i\<totalImages; i++){  
var loader:Loader = new Loader();  
loader.load(new URLRequest(“images/”+String(xml.children()\*.@brand)));  
images.push(loader);  
// loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onProgress);  
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);  
}  
}

function onComplete(e:Event):void{  
imagesLoaded++;  
if(imagesLoaded == totalImages){  
createImages();  
}  
}

function createImages():void{  
for(var i:int = 0; i \< images.length; i++){  
var bm:Bitmap = new Bitmap();  
bm = Bitmap(images\*.content);  
bm.smoothing = true;  
bm.x = i\*170;  
container\_mc.addChild(bm);

```
  var caption:textfile=new textfile();
  caption.x=i*170; // fix text positions (x,y) here

```

caption.y=96;  
caption.tf.text=(xml.children()\*.@brandname)

```
  container_mc.addChild(caption);

```

}  
}
