• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

refreshing xml data

Participant ,
Oct 24, 2008 Oct 24, 2008

Copy link to clipboard

Copied

How do you force Flash to refresh its xml data?

I have a Flash app that uploads an xml file using URLLoader() and URLRequest(). But this file gets overwritten every 10-30 minutes with fresh data. The only way I've found so far to view changes in the xml data is to refresh my web page (F5 or Ctrl-->F5). Short of turning to Javascript, isn't there some way for Flash to refresh its xml data?
TOPICS
ActionScript

Views

657

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2008 Oct 24, 2008

Copy link to clipboard

Copied

Try appending the file name, something like this:

var myURL="www.address.com"
myURL =myURL + "?r=" + new Date().getTime().toString();

var PageRequest=new URLRequest(myURL);
var PageLoad:URLLoader=new URLLoader;
PageLoad.load(PageRequest);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 24, 2008 Oct 24, 2008

Copy link to clipboard

Copied

If you want the XML to update in Flash, you'll have to set an interval and reload it each interval iteration. This is called "polling" the XML data. Using an XML file there's no way to make the Flash Player in the browser know that the XML has changed without the Flash Player requesting the XML file again.

Use flash.utils.setInterval to reload it every 5 or 10 minutes, for instance:

setInterval(loadData,5*60*1000); // minutes * seconds * milliseconds
function loadData(){
// .. load XML data
}

rob day's advice is also very important in order to keep the Flash Player form caching the XML and not refreshing properly (like when you have to do Ctrl+F5 in the browser.)

HTH

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 25, 2008 Oct 25, 2008

Copy link to clipboard

Copied

LATEST
Good Idea

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines