PDA

View Full Version : preventing caching of swf's and xml files


dnporch
06-26-2010, 04:09 PM
Hi, can't find a good resource on how to properly go about this. my site is set up as follows
index.html calls the main .swf file.
the main .swf file calls an external .swf file.
the external .swf file calls an .xml file. (a photo list for a gallery)
when i update the .xml file or either of the .swf files i need to manually reload these files from the browser to refresh them. ie. navigate to:
site.com/main.swf
or
site.com/photo.xml
and then refresh those before i can just navigate directly to
site.com
to see my updated content. anyone aware of any resources or tutorials that can offer me some insight into how to gain more control over this? ideally it would be nice if the browser could do a quick comparison of the cached file with the actual file and then determine if a refresh is necessary but if it just has to reload everytime, the site isn't too large and i could live with that for now. thanks in advance!

adninjastrator
06-28-2010, 04:14 AM
If I understand your problem correctly, you want to be sure that the newest version of the xml file always loads, not an older cached version?
If that's the case, you might try using the same method that I use on one of my Flash news tickers, which always needs the newset version of the xml file.
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news_ticker.xml?blarg="+new Date().getTime());
This method doesn't prevent caching but rather appends current date and time to the end of the xml file name, so it always loads a different xml file. I believe I adopted this from
http://www.kirupa.com/developer/mx2004/newsticker2.htm
Check it out, it's a good explanation.
Best wishes,
Adninjastrator