Hi.
I am developing an online virtual world to teach English. The good thing about flash is the browser caché so you don't wait for eveything to load everytime BUT I am having problems when I update a file. If I don't empty the caché then the old file is loaded and the new one ignored. There must be a solution to this otherwise people will always end up with an old version of all my files. We CANT expect a client to clear his/her caché obviously. I have never been asked to do that by any online product but I sometimes see updates so there is a way.
Cheers in advance for any help.
One approach is to add a random number query variable to the file string so that the call is forced to go to the server to process the query string, as in...
new URLRequest("http://www.site.com/geData.php?&nocache="+Math.random());
Thanks Ned. Sorry for the delay in anwsering as I have been away.
On updating I supoose it only updates one of the swfs not all of them. Is that right?
I was also given the following code in another forum. Is it similar to yours and is one way better than another?
var loader:URLLoader = new URLLoader();
var header:URLRequestHeader = new URLRequestHeader("pragma", "no-cache");
var request:URLRequest = new URLRequest("Main.xml" + "?" + new Date().getTime());
request.requestHeaders.push(header);
loader.load(request);
If we use swfobject.js we can use the following:
swfobject.embedSWF( 'index.swf ?'+ new Date().getTime()...
We can put 2012-011 as the date and so update every month.
We could also take out the "break cache" code and there will be no updating. (is that right although a little tedious)
BUT
Are all the files in the cache updated or only the newer ones?
PLEASE confirm which is the best method as I am a little confused. There seems to be the swfobject, an html request etc... as possible methods and I just need to know which is best and most importantly how I can update only one specificfile.
THANKS
North America
Europe, Middle East and Africa
Asia Pacific