I am using an XML document to display data in flash. I have the swf embedded in html but I now realize that this won't work. You see the xml data needs to be updated every few minutes. Does anyone know of a simple way to refresh the swf so that it can read from the updated XML and display accordingly in the browser ?
Refreshing flash
Collapse
X
-
You can use setInterval if you want to update the xml reading in a fixed ammount of time. So the setInterval will call the xml.load function every time the time lapse ends.
Or simply reload the xml when needed calling the xml.load("thefi le.xml"). May be you want to update the file every time the user does a certain thing.
If you are going to use the setInterval, you should do something like the following:
[CODE=actionscri pt]
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
//the methods to handle the xml
}
var intervalID = setInterval(thi s, "loadXML",2*60* 1000);
//being the interval 2 minutes, since the setInterval uses milliseconds
function loadXML() {
xml.load("thefi le.xml");
}
[/CODE]
If in some point you want to stop the interval you should use clearInterval(i ntervalID); and that's it.
Kind regards.
The_Nephilim
Originally posted by jacksoncnI am using an XML document to display data in flash. I have the swf embedded in html but I now realize that this won't work. You see the xml data needs to be updated every few minutes. Does anyone know of a simple way to refresh the swf so that it can read from the updated XML and display accordingly in the browser ? -
You're welcome!Originally posted by jacksoncnthanks. i got it. appreciate it.
Good luck with your app!
Regards,
The_NephilimComment
Comment