Avoid cacheing of variables textfile

On some systems the loaded textfile is cached, so that loading it again, gives you the same result, even if the textfile has changed. To avoid this, append time as parameter to the url of your textfile. In the following you can find a function, which does all the magic. ATTENTION: This doesn't work from your local harddisk, you have to upload the file to your webserver. frame 1: function loadVariablesWithoutCache(url, targetstring){ //are there already vars appended to the url ? if(url.indexOf("?") == -1){ //no, no vars appended eval(targetstring).loadVariables(url add "?time=" add getTimer(), ""); } else { //yes eval(targetstring).loadVariables(url add "&time=" add getTimer(), ""); } } //Provided you copy the function to the first frame of your movie, //you can call it from any place in your movie like this: _level0.loadVariablesWithoutCache("myvar.txt","_level0");
Carsten Wilke Date: 21/06/2001

Hi! I wanted to use your nocaching function. Is it possible to use it with flash 4? Many thx, Carsten
pankajgorana Date: 02/08/2001

hi! can i save my input text box field (eg.--textfield1) ver to text.txt file.
Chris Dunan Date: 29/10/2001

Hi there, I\'ve got the function on the first frame as you have said, and for experiments sake put the code to load the txt file on the second frame. I get an error opening the file.. Any ideas? it just wont work! Cheers Nice Site btw! Chris
Hi Chris, i'm sorry to say that, but this function only works online -- bokel
Dragan Date: 17/03/2002
or if you have PHP (or similar), you can append the Session ID no. a Session ID doesn't create cookies on your system, it exists as long as you are on that site (close browser). it's a temporary server-side unique session id. in the head of the PHP doc, where your SWF movie is embedded, write: <? session_start(); // must be at the very top of the document, no whitespace!! $SID = $PHPSESSID; // create the var ?> (hereafter comes the regular HTML / object/embed tags etc.) in your .fla then add the SID var when you call the textfile loadVariablesNum("myTextFile.txt",0,"POST"); like this, the query string is then something like "myTextFile.txt?SID=skskd82939SAdkd829489sdfs9df98asdfkks" in other words "unique". this is also the basic "glue" for building stuff like shopping carts etc.
o Date: 21/05/2002
k7c4 Date: 14/08/2002
It should work locally, if you use file://-Protokoll fro embedding HTML-File or SWF directely, so instead of opening c:\swf\file.swf?var=value do it like this file://C|/swf/file.swf?var=value
Add comment