XML & AS3 Help Needed

Hi there,

I am having a small problem bringing in XML to show thumbnails of projects… each thumbnail then needs to have a next and previous button to scroll through the images for the project.

I have got it to show one project (which cycles through all of the images in the XML) but i need to separate it out to show the first image of each project as a separate thumbnail.

here are the main workings of my code:

function processXML(e:Event):void {
    myXML = new XML(e.target.data);
    loadXML();
}

function loadXML():void
    {
    picsList = myXML.images.image;
    trace(picsList);
    pictureLoader.load(new URLRequest(picsList[counter].attribute("source")));
}
    
function animate():void
{
    pictureLoader.load(new URLRequest(picsList[counter].attribute("source")));
    TweenLite.to(pictureLoader, 1, {alpha:1});
    trace(counter);
}
function nextButton(event:MouseEvent):void
{   
    if (this.counter < this.myXML.images.image.length()-1)
    {
    this.counter = this.counter + 1;
    }
    else
    {
        counter = 0
    }
    TweenLite.to(pictureLoader, 1, {alpha:0, onComplete:animate});
} 

function prevButton(event:MouseEvent):void
{   
    if (this.counter <= 0)
    {
        this.counter = this.myXML.images.image.length()-1
    }
    else
    {
        this.counter = this.counter -1;
    }
    TweenLite.to(pictureLoader, 1, {alpha:0, onComplete:animate});
}

and my xml file is laid out like so:

<projects>
<images>
<image source= "thumbs/thumb2.jpg" text="one"></image>
<image source= "thumbs/thumb3.jpg" text="one"></image>
<image source= "thumbs/thumb4.jpg" text="one"></image>
</images>

<images>
<image source= "thumbs/thumb5.jpg" text="one"></image>
<image source= "thumbs/thumb6.jpg" text="one"></image>
</images>

</projects>

i presume it will need a for each loop for each images element, but i cant quite crack the code yet.
Any help or advice is much appreciated

Regards
Dan