Flash player or firefox browser caching XML file, prevents flash animation from updating
Question:
We want to use our flash animation hosted on a 3rd party site, to display data from an XML file that we host, that we can change at will.
We have prototyped the animation accessing the XML file via URLLoader(); call in ActionScript3.0, and then displaying the data. The animation runs in a loop so when its finished displaying it goes back and starts again with another call to URLLoader();
However if I make a change to the XML file, depending on the browser being used, the flash animations can be a bit sluggish to pick up the changes.
I suspected it might be due to the browser or flash player caching the XML file, and then waiting for the cached version to expire.
I’m new to browser caching and just about getting to grips with wireshark and FF’s about:cache, but have precious little else know-how in this area.
Running wireshark with a HTTP filter showed that on IE8, pretty much every time the animation looped a HTTP GET was made:
GET /.DARD/file1.xml HTTP/1.1
Accept: */*
Accept-Language: en-US
Referer: http://domain.com/zGeneral/latest/banner.swf
x-flash-version: 10,0,2,54
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)
If-Modified-Since: Mon, 23 Nov 2009 15:15:16 GMT
Host: www.remote.co.uk
Connection: Keep-Alive
Cookie: blahhhhhhhhhhhhhhhhhhhh
mostly it returned a not modified….
HTTP/1.1 304 Not Modified
Date: Mon, 23 Nov 2009 15:45:44 GMT
Server: Apache
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
except jiust after the XML was changed when we get a download….
HTTP/1.1 200 OK
Date: Mon, 23 Nov 2009 15:46:48 GMT
Server: Apache
Last-Modified: Mon, 23 Nov 2009 15:46:30 GMT
Accept-Ranges: bytes
Content-Length: 101
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/xml
/r/n
<?xml……………dataaaaaaaaaaaaaaaa >
then the datestamp in the Last-Modified field of the response becomes the value in the If-Modified-Since field in the next request.
All very sensible, and works well.
******* However in FireFox… *********
Even though the animatin is happily looping thru’ and making its calls to URLLoader, NO HTTP GET on the XML file is happening !!
A typoing “about:cache” into the address bar shows us that the XML file is indeed cached, with an expiry of an hour and 20 minutes after it was last modified.
So, what I want to know is what setting in IE8 is it that is making IE8 use sensible caching here?
(sorry if an easy one, but wireshark, about:cache etc are all new to me). Or does IE8 just come hardwired like this?
the converse question for FF. What setting in FF makes it “stupid” here, or is it just born stupid.
In other words can the browsers (in general) be configured to be useful here.
OR, for all ActionScript / HTTP heads – how can I call URLLoader in such a way that it always FORCES a download and overrides/ignores any caching?
To be really useful, our application can handle info being a few minutes out of data, but an hour and 20 is harder. Then again if its down to browser settings, the delay in the file expiring could be totally aribitrary and we might have to rethink this one!!
Solution:
I dont’ understand that point – about the flash app looping and (what? completely reloading? that’s really inefficient, given it’s already loaded into memory and running).
What happens in the code – is this Flex or Flash – what happens at the end of animation, is there a reload on the url?
Why doesn’t the app just internally reset state and replay?













Comments (0)
Trackbacks - Pingbacks (0)
Leave a Reply