How to load xml data and present it across multiple frames in AS3

drandhra

New Member
I'm trying to load data from an xml file, load them in arrays and present words from these arrays in different frames in a dynamic text field. So for example, WordArray[0] will be presented for two frames in the DynText textfield. Following this presentation, WordArray[1] will be presented for four frames in the same text field and then KeyWordArray[0] will be presented for one frame in the same text field, etc.Here is the code I have so far:\[code\]var xmlLoader:URLLoader = new URLLoader();var xmlData:XML = new XML();xmlLoader.addEventListener(Event.COMPLETE, LoadXML);xmlLoader.load(new URLRequest("file2.xml"));function LoadXML(e:Event):void {xmlData = http://stackoverflow.com/questions/10758550/new XML(e.target.data);ParsePass(xmlData);}var WordArray:Array = new Array();var KeyWordArray:Array = new Array();function ParsePass(passInput:XML):void {var WordAll:XMLList = passInput.Pass.Word.text();var PrimeAll:XMLList = passInput.Pass.Keyword.text();for (var i in WordAll) { WordArray.push(WordAll);}for (var p in PrimeAll) { KeyWordArray.push(PrimeAll[p]);}}\[/code\]I am able to load the xml data, put it in arrays and present WordArray[0] in the first frame in a dynamic text field using:\[code\]DynText.text = WordArray[0];\[/code\]but not in the other frames. I have tried to call functions within the ParsePass function, but it does not seem to work. I am sorry if this is a basic question. I am new to AS3. But I have searched the web and did not find any relevant answer to my question. So any help would be very appreciated.
 
Back
Top