In one of our Flash project we're using XML file for UI text content loading. The XML get reloaded after specific time interval to keep UI updated. This works fine for few time intervals. But after some random number of reloads, despite of XML loading, I'm unable to read one of the child element from the XML loaded.
Action Script Code:
function LoadCaptions(file : String) : void
{
captions_LDR = new URLLoader();
captions_LDR.addEventListener(Event.COMPLETE,CaptionLoadComplete,false,0,true);
try
{
captions_LDR.load(new URLRequest(file));
}
catch (e : Error)
{
trace("captions_LDR : " + e);
captions_LDR.load(new URLRequest(file));
}
}
function CaptionLoadComplete(event : Event) : void
{
captions_XML = new XML(captions_LDR.data);
try{ voiceLOAD(system_PATH + base_PATH + voice_PATH + voice_FILE);
}catch (e : Error){}
try{ configDynamicLOAD(system_PATH + base_PATH + configDynamic_PATH + configDynamic_FILE);
}catch (e : Error){}
}
If I print loaded XM it prints as : (trimmed to sample it).
<captions airportCode="HSV" airportName="Huntsville Intl-Carl T Jones Field">
<!--
<caption id="805E123F" unicodeFont="no" name="English"><!--
<en>English</en>
</caption>
</captions>
But if I try to access the first caption element using code
captions_XML.child(0).children()
instead of content i.e. 'English', it returns blank.
What I have tried:
I have tried to reload the XML file if I'm not able to access the element value. But then also, XML gets loaded properly, it event prints the XML content but if I try to access the first child element value, it again give blank. So, the reloading logic gets stuck into deadlock loop.