AS3 dynamic XML gallery help

Hi All,

I’m currently trying to create a (what I thought would be) relatively simple XML gallery in AS3.

What I currently have is my thumbnails being brought in through the XML and distributed horizontally at the bottom of my stage - great.

Now, my XML also contains a URL which links to a video clip which I would like to be loaded into a video area when each of the relevent thumbnails is clicked.

How can I go about achieving this? I’ve come to a bit of a stuck as I can’t correlate how to get the URL passed through to the function I have onPress of my enlarging button. In AS2 I would do this in a global variable however i’m aware this isn’t available in 3.

Below is my code that is parsing the XML and generating the thumbnails at the bottom of the stage.


function ParseDVDs(DVDs:XML):void {
    trace("XML Output");
    trace("------------------------");
        
    var coverList:XMLList = DVDs.product.coverimage.text();
    for each (var coverElement:XML in coverList) {
    //trace(coverElement);
    
    rad = rad + 100;

    var newThumb:Thumb = new Thumb();
    this.addChild(newThumb);
    
    newThumb.x = rad;
    newThumb.y = 317;

    var myLoader:Loader = new Loader()
    var url:URLRequest = new URLRequest(coverElement);
    myLoader.load(url);
    newThumb.holder.addChild(myLoader);

    }
}

Any help with this would be very much appreciated.
Thanks