Use XML property

[COLOR=Black]i have loop calling thumbnails dynamically and placing on the stage. clicking them loads larger images. works fine. so you click a thumb, a larger image opens and is possibly 1 of 6. i added an attribute in my XML, quantity.

flash should check the quantity and if its greater than 1 to load buttons to go to the next image.

my problem is i cant get flash to trace the correct quantity number for each thumbnail in the .xml file. it just is stuck displaying the first node’s quantity over and over on every click. so im assuming its a scope issue


stop();
import gs.TweenMax;
import gs.easing.*;
import gs.events.TweenEvent;
var imageText:TextField = new TextField();
var quan:Number;

var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("dansite1.xml"));

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

//PLACING THUMBNAILS AND PREPPING ON CLICK
function xmlLoaded(event:Event):void
{
    xml = XML(event.target.data);
    xmlList = xml.children();
    for(var idx:int = 0; idx < xmlList.length(); idx++)
    {
        imageLoader = new Loader();
        imageLoader.load(new URLRequest(xmlList[idx].thumbnail.text()));
        if (idx < 4) {
        imageLoader.x = 25;
        imageLoader.y = (idx * 150) + 25;
                } else if (idx > 3 && idx < 8) {
                imageLoader.x = 200;
                imageLoader.y = (idx * 150) - 575;
                }else{
        imageLoader.x = 400;
        imageLoader.y = (idx * 150) - 575;
        }
        
        thumbs.addChild(imageLoader);
        imageLoader.name = xmlList[idx].source1.text();
        quan = idx;
        imageLoader.addEventListener(MouseEvent.CLICK, showPicture);
    }
}

//LOADING LARGER PICTURE
function showPicture(event:MouseEvent):void
{
    imageLoader = new Loader();
    imageLoader.load(new URLRequest(event.target.name));
    imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);

//TRYING TO CALL QUANTITY VALUE BASED ON CLICKED THUMBNAIL
trace(xmlList[quan].quantity.text());
         } 


someone recommended treating things as an array and use [/COLOR]xml.image.quantity.child(0)[3];

but im not familiar enough with .xml parsing to know exactly what to do here. any help?