Hello everyone,
I have a specific question geared towards XML.
I currently have several documents that have been formated using XML.
So for instance, I have multiple documents that are named doc1.xml, doc2.xml, doc3.xml, etc…
I then have a doclist.xml that carrys the information regarding all the documents.
So this doclist.xml has doc1.xml, doc2.xml, and etc… as its Subchild nodes.
Currently, I’ve managed to display one document on the screen. However, my for loop currently skips all the previous documents except for the final one. Is there a way for flash to put all the texts on the screen without skipping everything until the last one?
Here’s my current code
stop();
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
var type:String = "govdoc.xml";
myLoader.load(new URLRequest(type));
var document:String;
var mydocXML:XML;
var mydocLoader:URLLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, processDocXML);
var k:Number = 1;
function processDocXML(e:Event):void {
myXML = new XML(e.target.data);
for(var i:int = 1; i <= myXML.*.length(); i++){
document = myXML.DOC["SUBDOC"+i];
mydocLoader.load(new URLRequest(document));
mydocLoader.addEventListener(Event.COMPLETE, processXML);
}
}
function processXML(e:Event):void {
mydocXML = new XML(e.target.data);
{
this["txt"+k].text = mydocXML.DOC.SUBDOC1;
k++;
}
}