View Full Version : Stop SWF files from caching!
boldlittletiger
03-28-2001, 03:18 PM
I've got a dynamic high scores page, which uses variables from a text file written with ASP. Problem is, when I go back to the game, get a new high score, and my high scores pop up, it shows the cached version of data in the swf file. I know this problem is caused by caching in my browser coz when I remove the file from my temp internet files it works a treat..
I've heard that you can use an FSCOMMAND to stop the swf file from cachin.. is this true? I can't find any literature on this at all..
Any ideas?
ta very much..
Jesse
03-29-2001, 01:22 AM
So your loading variable from a text file?
Your problem would be caching of the text file then, so make your code this (assuming your file is called 'datat.txt'):
loadVariablesNum ("data.txt?noCache=" + Math.floor(random(1000000) / random(1000)), 0);
Or soemthing similar. All this deos it generate a random number to appaned tot he variable call so that you don't call the same file twice. (Well you do actually call the same file veery time, but the URL is different so the browser wont cache it)
Cheers
Jesse
boldlittletiger
04-02-2001, 10:29 PM
buzzin mate.. I should have realised!! pure guroooo!
I'll be round if it doesn't work!!! ;)
cheers very much!
Justin
http://www.boldlittletiger.com/
MartinThorpe
04-03-2001, 12:00 PM
Will this work in Flash 4?
Jesse
04-03-2001, 12:10 PM
yes but you have to use different code and Flash 4's random function isn't so great... something like:
"data.txt?noCache=" & ( random(10000) + random (123456) )
that should do you
Cheers
Jesse
MartinThorpe
04-03-2001, 12:21 PM
Thanks very much for that... it works fine.. brilliant cheers
Martin
boldlittletiger
04-05-2001, 09:54 AM
da man..
Sjuul
04-27-2001, 12:40 PM
What you should do is put
<% Option Explicit
Response.Expires = 0 %>
In the ASP file. This instructs the browsers not to cache the data.
If people have viewed the page before you have added the lines to the ASP file, they will still get the cached copy. So it only works if you don't already have a cached copy.
MartinThorpe
04-27-2001, 12:44 PM
I am working in Coldfusion... there is a similar command in CF to do this, but it does not affect the swf.
Sjuul
04-27-2001, 02:04 PM
Isn't that just what you want? I'd say you'd want to have the .swf cached, so it loads quickly, and have it load it's data from the asp/coldfusion/php/whatever page, since it's not the .swf that changes, just the data
MartinThorpe
04-27-2001, 02:44 PM
Changing the variable CF text file will not change the swf file,which is calling it, unless you clear the cache and reload the swf file. The technique described above, using the random actionscript function, will alter the swf file each time you alter the CF text variable file.
boldlittletiger
04-27-2001, 05:18 PM
I see what you're saying with the asp code sjuul.. but that's surely not going to effect the browser in terms of caching a text file.. I want the swf to cache but not the text file.. therefore.. the variable name on the end of the text file url will do the trick ample..
nice try though!! *G*
Sjuul
04-28-2001, 08:49 PM
Yes a nice try. And one that works too. I've used this one, it's not just a thought. The asp code makes the server tell the browser it must not cache the text file.
I used it in the guestbook of http://www.framfab2001.nl
boldlittletiger
04-30-2001, 10:33 AM
I know man.. I'm an asp programmer..
;)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.