PDA

View Full Version : flash chat and cache problems


TheLargeOne
09-04-2001, 03:29 PM
i've been getting really annoyed with a chatroom i'm trying to make. i'm using flash to read a text file that is updated by a cgi scrip. the cgi script is on its way but i'm having trouble with the flash.

i'm using a dynamic textbow with the action

loadVariables ("chattext.txt", 0);

and to make it refresh i'm cycling through 3 frames at 1fps so it looks at the file every 3 seconds.

its so simple as it works so sweetly on my computer i had images of selling it to my webdesigner mates for thousands.
The problem came when i put it on the server. when you use the browser and the swf file looks at the text file, the first time that page loads it comes up with the text in the text file. but if the text file changes the browser doesn't. Cacheing problem i'm sure but how do i solve it?

any ideas?

TheLargeOne
09-04-2001, 08:12 PM
ok, me and a mate of mine have figured out whats going wrong but still don't know how to fix it.

the flash caches the txt file it is looking at, and every time the swf file tries to look at the variable in the file it just looks at the cached file. therefore it won't change when the text file changes on the server. Bum.

i tried using the peice of script i found when i searched the forum and came up with:

filename.txt?noCache=" + Math.floor(random(1000000) / random(1000))

this makes a new cache evertime the .swf file is reloaded, but the trouble is that when the chatroom is running the .swf file isn't reloaded and so doesn't get the new txt file.

I need a way to stop the .swf file caching anything at all. Please tell me this is possible!

Immulsifier
09-04-2001, 10:34 PM
I had this prob with my flashforums and got round it using this.

loadVariablesNum ("forums.asp?random=" + Random(9999999), 0, "POST");

Works with Flash 5 and adds a random number onto the url which is ignored, hence it thinks its loading a different address each time.

Problem solved :)

Immy

Immulsifier
09-04-2001, 10:35 PM
BTW my forums are at http://www.flashforums.com if you fancy a look. Thats the old version on there tho. Loads more new bits in my latest one but i only about 75% into it at the mo :)

TheLargeOne
09-05-2001, 01:17 PM
cheers for that it works fine now. just one question though...
does this cache a new file every time it tries to update? if it does peoples harddrives are going to be full of little text files and another one is going to be added every 3 secs.....