# Flash player locks while reading in xml

**URL:** <https://forum.kirupa.com/t/flash-player-locks-while-reading-in-xml/276008>\
**Category:** flash\
**Created:** [November 21, 2008, 8:37am UTC](https://forum.kirupa.com/t/flash-player-locks-while-reading-in-xml/276008 "2008-11-21T08:37:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SolBrad](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@SolBrad](https://forum.kirupa.com/u/SolBrad)\
**Post date:** [November 21, 2008, 8:37am UTC](https://forum.kirupa.com/t/flash-player-locks-while-reading-in-xml/276008/1 "2008-11-21T08:37:31Z")

</div>

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
