0

We created a simple Flash animation that reads from an XML file in another server. This XML file has tags with the path of several images that will be displayed in the Flash. The xml tag looks like this:

<image_name><![CDATA[assets/images/image1.jpg]]></image_name>

When I tested locally I realized that, even after I changed the image in the XML, the SWF was still showing the image from the browser cache. So the developer ended up adding some random function so that the cache would not be an issue. That fixed the issue.

Unfortunately, the webhost that will publish the SWF tells me that they can't upload the SWF because the system doesn't allow SWF files that use random functions. So I can remove it and resubmit, but then the problem with the cache will be there.

Is there another alternative?

Thanks.

2 Answers2

2

Preventing caching at all isn't a good idea in general, it's very useful feature that safes server traffic and decrease swf loading time.

Some of the solutions here can be to change URL in the xml config by adding version of the image manually:

 <image_name><![CDATA[assets/images/image1.jpg?image_v1]]></image_name>

or generate this version automatically with script as md5 of the image bytes:

 <image_name><![CDATA[assets/images/image1.jpg?5d41402abc4b2a76b9719d911017c592]]></image_name>

but it's required much more setup work.

Or add the version of the swf application:

 <image_name><![CDATA[assets/images/image1.jpg?app_v1]]></image_name>

the last solution is a compromise between two options - maintaining version of each image file and removing cache at all. In this case you have to maintain only the version of swf file, but you have to update it each time you change some of the images.

fsbmain
  • 5,267
  • 2
  • 16
  • 23
0

Preventing cache isn't good, but here is my solution: use a "random" number (current time in seconds) as a param assets/images/image1.jpg?t=RandomNumber.

Iagows
  • 1,049
  • 9
  • 8