pletcherxuo
New Member
So I am working on a SWF using AS 2.0. It needs to access exchange rates from an XML file. I already have a setInterval that iterates through XML child nodes. So I already have a timer running in my code. I need to set another timer in order to reload the XML so that changes to the XML are constantly updated say every 20 seconds. When I try to do that the timers overlap. Can you guys help?? ThanksHere is my current code:\[code\] var index:Number = 0; var myxml:XML = new XML(); myxml.ignoreWhite = true; myxml.onLoad = function(success:Boolean):Void{loadData();setInterval(loadData, 3000);};function loadData(){var messages:XMLNode = myxml.firstChild;if(index >= messages.childNodes.length) index = 0;var my_message:XMLNode = messages.childNodes[index];_root.status_1.htmlText = my_message.childNodes[0].firstChild.nodeValue; _root.status_2.htmlText = my_message.childNodes[1].firstChild.nodeValue; _root.status_3.htmlText = my_message.childNodes[2].firstChild.nodeValue; _root.status_4.htmlText = my_message.childNodes[3].firstChild.nodeValue;_root.status_5.htmlText = my_message.childNodes[4].firstChild.nodeValue;_root.status_6.htmlText = my_message.childNodes[5].firstChild.nodeValue; index++; }myxml.load("data.xml");\[/code\]MY XML File looks like this:\[code\]<?xml version="1.0" encoding="utf-8"?> <messages> <message> <item>1.38329</item> <item>1.58344</item> <item>1.06960</item> <item>93.7300</item> <item>0.9864</item> <item></item></message><message > <item>1.36789</item> <item>1.56734</item> <item>1.03752</item> <item>93.7267</item> <item>0.97836</item> <item></item></message><message > <item>1.38126</item> <item>1.59104</item> <item>1.05380</item> <item>93.5755</item> <item>0.9923</item> <item></item></message><message > <item>1.38126</item> <item>1.29789</item> <item>1.5423</item> <item>1.07123</item> <item>93.7268</item> <item>0.9867</item> <item></item></message><message > <item>1.38329</item> <item>1.514762</item> <item>1.07451</item> <item>93.7277</item> <item>0.9975</item> <item></item> </message></messages>\[/code\]