XML:
<adList>
<ads>
<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”/>
…
</ads>
</adList>
There will be 1000-1200 “ads” in the XML file.
What I am needing:
I have 10 MCs, named adBlock0-adBlock9
I am needing the XML to load and assign the 1st ad to adBlock0, 2nd to adBlock1, and so on (through adBlock9). I then need (after 30 sec.) adBlock0 to go to the next (unassigned) ad, followed by adBlock1 30 sec. later, and so on.
Make sense?
So far I have in my AS:
contentXML = new XML();
contentXML.ignoreWhite = true;
contentXML.onLoad = function(success){if (success){parseThis();trace(“Loaded”);}}
contentXML.load(“adFile.xml”)
function adCounter(){
if (currentAd<adSets.length){
currentAd++;
counterNumber.text=currentAd
} else if (currentAd==adSets.length){
currentAd=0;
}
}
//the following parses the XML and traces what I am needing.
function parseThis(){
var adListing = contentXML.firstChild.firstChild;
var adSets = adListing.childNodes
for(var i=0;i<adSets.length;i++){
currAd=adSets*;
trace(currAd.attributes.id)
}
Problem:
How do I assign the ads to the adBlock MCs, in the fashion I am needing? Also, setInterval will be needed (I’m assuming) to change the ad every 30 sec., but how would I set this up?
Thanks