Refresh XML content in Flash – get rid of Flash files cache

Facebooktwitterredditpinterestlinkedinmail

If you ever had to deal with Flash and XML files that changes dynamically  you probably have noticed that it doesn’t matter what you doing.. you change the XML content but in the flash file it wont update… refreshing the browser wont help – just deleting the cached files, NOT !

one small trick is to make the browser think it loads different XML file… how we going to do that ? just add an extra information  to your XML request:

The XML declaration:

var testXML = new XML();

Original request: testXML.load(“http://somesite.com/myfile.xml”);

new request: testXML.load(“http://somesite.com/myfile.xml?”+ (Math.random() * 500));

or, if you want to be more accurate, add these :

varUnique=new Date().getTime()

testXML.load(“http://somesite.com/myfile.xml?”+ varUnique);

In addition, you can call php file in same way to load other type of content.

Hope it will help you.

One thought on “Refresh XML content in Flash – get rid of Flash files cache

Leave a Reply

Your email address will not be published. Required fields are marked *