Hello,
I’m new to the group and to Flash coding. I’m working on a proof of concept for work and I am completely stumped. With my limited knowledge and a lot of questions I have been able to get my template working but now the tricky part, it loads from 1 XML file just fine, but I need to cycle through 3-4 files that are identical in format, just different feeds.
I have literally spent 3 days trying to figure this out and I just keep breaking it. If someone could have a look at my code and suggest how to do it I would greatly appreciate it.
var xmlholder:URLLoader = new URLLoader();
xmlholder.addEventListener(Event.COMPLETE, onload);
var timer:Timer = new Timer(10 * 2000); // update every 20 seconds
timer.start();
//timer.addEventListener(TimerEvent.TIMER, timerUpdate);
var currentTimeUpdated:String;
loadXML();
function timerUpdate(e:TimerEvent):void
{
loadXML();
}
function loadXML():void
{
xmlholder.load(new URLRequest("feed1.xml"));//?t=" + timestamp()));
}
function onload(e:Event):void
{
var myXML:XML = new XML(xmlholder.data);
//if(myXML.@timeUpdated != currentTimeUpdated)
for (var i:int =0; i<myXML.details.length();i++)
{
title.text=myXML.event_info[0].event_short_name;
buyin.text=myXML.event_info[0].buyin;
entries.text=myXML.event_info[0].entries;
first_place.text=myXML.event_info[0].first_place;
remaining.text=myXML.event_info[0].remaining;
var row:MedalRow = new MedalRow();
var ldr=new Loader();
row.y=80+i*row.height+10;
currentTimeUpdated =myXML.@timeUpdated;
row.last_name.text=myXML.details*.last_name;
row.first_name.text=myXML.details*.first_name;
row.chips.text=myXML.details*.chips;
this.addChild(row);
var ldr = new Loader();
ldr.load(new URLRequest("flags16/"+String(myXML.details*.country_id).toLocaleLowerCase()+".png"));
row.flagHolder.addChild(ldr);
}
}
function timestamp():String
{
return stage.loaderInfo.url.indexOf("http") == 0 ? "?t=" + new Date().time : "";
}
Many thanks,
Randy
Montreal, Canada