I’m having a major brain fog right now…I’m trying to add a click event for each menu item that is loaded from an XML file.
See code below:
function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();
for (var i:int=0; i<xmlList.length(); i++)
{
var logo:Logo= new Logo(xmlList*.imgPath);
arrayImg.push(thumb);
thumb.buttonMode = true;
imgURL = xmlList*.imgURL.toString();
arrayImg*.addEventListener(MouseEvent.CLICK, logoOnClick);
arrayImg*.y = 70;
arrayImg*.x = (i*100)+45;
logoContainer.addChild(logo);
function logoOnClick(event:MouseEvent):void
{
trace(imgURL);
}
}
}
So basically everytime a click event occurs on a menu item, the related url from the xml file will be called. However the trace(imgURL) only shows the last item loaded from the XML file which makes sense.
I just can’t see how to modify the code so the unique url is associated with each unique menu item click event.
Thx a million