Nested loops (XML) for values

I have a project that needs to take the following XML:


<?xml version=“1.0” encoding=“iso-8859-1”?>
<adList>
<adBlock id=“0”>
<ad id=“thisNumber0” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber1” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
</adBlock>
<adBlock id=“1”>
<ad id=“thisNumber0” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber1” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber2” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
</adBlock>
<adBlock id=“2”>
<ad id=“thisNumber0” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber1” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber2” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
</adBlock>
<adBlock id=“3”>
<ad id=“thisNumber0” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber1” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber2” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
<ad id=“thisNumber3” imageFile=“thisAd.jpg” videoFile=“video.flv” couponImage=“this.bmp”/>
</adBlock>

</adList>


I am needing to loop through using an array and assign the values to a set of ten MC_buttons (labeled adBlock0-adBlock9).

My AS:
contentXML = new XML();
contentXML.ignoreWhite = true;
contentXML.onLoad = function(success){
if (success){
parseThis();
trace(“Loaded”)
;
}
}
contentXML.load(“contentFile.xml”)

function parseThis(){
var adListingContents = contentXML.firstChild.childNodes;
for (var i=0; i<adListingContents.length; i++)
{
for(k=0;k<12;k++){
this[“adBlock”+k].thisPath=adListingContents[k].attributes.id
this[“adBlock”+k].onRelease = function(){
trace(this.thisPath)
}
var adListing = adListingContents*;
var ads = adListing.childNodes;
for (var j=0; j<ads.length; j++)
{
var ad = ads[j];
}
}
}
}

//I need the following assigned from the <ad> childnodes of each <adBlock> section in the XML file :
//this[“adBlock”+k].adID
//this[“adBlock”+k].imageFile
//this[“adBlock”+k].videoFile
//this[“adBlock”+k].couponImage

I have no problem reading and assigning the “thisPath”, but I’m not sure how to then assign the adID/imageFile/… with the other loop.

I’ve read through the Senocular tut (it’s great), but it’s starting to overwhelm me.

I understand the single/XML for assigning content, but I don’t usually use it to this extent.

Any ideas?

Thanks