hey guys, i have this photo gallery that is linked to an xml file, and was wondering how do you add a click event to the image? for example when you click on first image, or the other images to open them in a popup window.

here is the actionscript txt:

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;

var galleryXML:XML;
var xmlLoader:URLLoader;
var xmlRequest:URLRequest;

xmlLoader = new URLLoader();
xmlRequest = new URLRequest('galleryXML.xml');

var numOfImages:int;
var currImage:int = 0;

var imageLoader:Loader;
var imageRequest:URLRequest;

imageLoader = new Loader();

var imagesList:Array = new Array();
var loadedImages:Array = new Array();

xmlLoader.load(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE,onComple te);

function onComplete(e:Event):void
{
galleryXML = new XML(xmlLoader.data);
numOfImages = galleryXML.photo.length();
var i:int = numOfImages;
while(i--)
{
imagesList.push(String(galleryXML.photo[i].url));
}
startLoading();
imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE,loadNext);
}

function startLoading():void{
imageRequest = new URLRequest(imagesList[currImage]);
imageLoader.load(imageRequest);
}

function loadNext(e:Event):void
{
if(currImage == numOfImages-1)
{
loadedImages.push(imageLoader.content);
imageLoader.contentLoaderInfo.removeEventListener

(Event.COMPLETE,loadNext);

var i:int = galleryXML.photo.length();
container = new Sprite();
while(i--)
{
var rect:Bitmap = loadedImages[i];
var bitmapCont:Sprite = new Sprite();
bitmapCont.addChild(rect);
container.addChild(bitmapCont);
bitmapCont.x = i * 120;
bitmapCont.width = 100;
bitmapCont.height = 60;
bitmapCont.addEventListener(MouseEvent.CLICK,draw) ;
bitmapCont.addEventListener(MouseEvent.MOUSE_OVER, overFunc);
bitmapCont.addEventListener(MouseEvent.MOUSE_OUT,o utFunc);
}
addChild(container);
container.y = 325;
addEventListener(Event.ENTER_FRAME,update);

return;
}
loadedImages.push(imageLoader.content);
currImage++;
imageRequest = new URLRequest(imagesList[currImage]);
imageLoader.load(imageRequest);
}

function overFunc(e:Event):void
{
e.currentTarget.width = 110;
e.currentTarget.height = 70;
}

function outFunc(e:Event):void
{
e.currentTarget.width = 100;
e.currentTarget.height = 60;
}


import flash.display.Sprite;
import flash.events.Event;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.MouseEvent;

var bd:BitmapData = new BitmapData(1022,767);

var b:Bitmap = new Bitmap(bd);
b.x = 75;
b.y = 15;
b.width = 400;
b.height = 300;
addChild(b);
var container:Sprite

var vel:Number = 0;
var acc:Number = 0;
var damp:Number = 0.95;


function update(e:Event):void
{
acc = 0;
if(mouseX<150)
acc = - - - -0.5;
if(mouseX>400)
acc = - - -0.5;
vel +=acc;
vel*=damp;
container.x += vel;
if(container.x>0)
container.x = 0;
if(container.x < 550-container.width)
container.x = 550-container.width;
}

function draw(e:MouseEvent):void
{
bd.draw(Sprite(e.currentTarget));
}

here is the xml one:

<?xml version="1.0" encoding="utf-8" ?>
<gallery>


<photo>
<url> 1.jpg </url>
</photo>

<photo>
<url> 2.jpg </url>
</photo>

<photo>
<url> 3.jpg </url>
</photo>

</gallery>

the fla file ,pictures and xml file must be in the same folder. have a go at it to see how it is, maybe you can do it.
thanks!