Hi
I am having a problem with reading in a fairly large xml file (20000 lines)
The problem is once i have loaded the xml file into flash, i start to parse the data into an array, during this period the flash file locks up for a few seconds.
Is there anyway around this problem, or at very least somehow have a preloader to show how long it will take to parse the xml?
Below is the code i currently have
userData_xml = new XML();
userData_xml.ignoreWhite = true;
var startTime:Number = getTimer();
userData_xml.onLoad = function(sucess)
{
if(sucess)
{
readxml(userData_xml);
}
else
{
trace(“error”)
}
}
function readxml(xmlDoc_xml)
{
var summaryArray:Array = new Array;
totalSummaryChildren = xmlDoc_xml.childNodes[0].childNodes.length;
for(i=0; i<totalSummaryChildren; i++)
{
summaryArray.push({dataLineType:xmlDoc_xml.childNodes[0].childNodes*.attributes.att, contract: xmlDoc_xml.childNodes[0].childNodes*.childNodes[0].childNodes[0].nodeValue, clientName: xmlDoc_xml.childNodes[0].childNodes*.childNodes[1].childNodes[0].nodeValue, product: xmlDoc_xml.childNodes[0].childNodes*.childNodes[2].childNodes[0].nodeValue, type: xmlDoc_xml.childNodes[0].childNodes*.childNodes[3].childNodes[0].nodeValue, date: xmlDoc_xml.childNodes[0].childNodes*.childNodes[4].childNodes[0].nodeValue, amount: Number(xmlDoc_xml.childNodes[0].childNodes*.childNodes[5].childNodes[0].nodeValue)});
}
var endTime:Number = getTimer();
var totalTimer:Number = (endTime - startTime)/1000;
this.loadTime_txt.text = “Completed in: " + totalTimer + " seconds”;
}
userData_xml.load(“data.xml”);
Is there anyway at all to speed this up?
Ps this needs to be done in as2
Thanks in advanced for anyone who can help