Reputation: 11
I don't want my swf flash file to be cached is there a way I can execute a code from my swf file to perform a cache clean? E.g I am posting my swf file on: www.newgrounds.com- I want a code in actionscript 2.0 to be deployed from my swf file when it is loaded. And that code should clear the loaded SWF file from the users cache or internet temporary folder, leaving no trace of it to be hacked or copied onto a NTFS Hard disk system, involving illegal or false distribution of my business files.
Upvotes: 1
Views: 4334
Reputation: 87
In my case, I solved this problem by using a custom SWF loader that loads the main SWF. The custom SWF loader uses a custom protocol to load the main SWF from the server. This makes copying SWF more difficult. HTTP/HTTPS can be used instead, but built-in actionscript HTTP classes (e.g., URLRequest, URLLoader) should not be used because they cache SWF files locally.
Upvotes: 1
Reputation:
I answered this a while ago, but can't find my post, so I'll re-answer it.
In order to control caching you need to send proper HTTP headers with the file. It is possible to configure every web server to send appropriate headers with either static or dynamic content, filter on file extension and so on. I say "control" because you don't want users to re-download the file even if it didn't change - you would both abuse the users' connection ad your server.
What you need to do is to decide how often do you want your SWF file to be checked for changes and set the time to store cache appropriately.
Alternatively, you could modify the name of the file to use in the HTML wrapper. Ideally, have versions of the SWF and whenever the file must be updated, replace it and rename. Obviously, this would require that you handle the headers of HTML file containing the SWF instead of SWF's own headers.
http://www.mnot.net/cache_docs/ this is a good document, that explains what to do with the headers, the meaning and consequences. must read :)
Upvotes: 0
Reputation: 90766
In your embed code, add a random parameter after the SWF filename. For example, if you use PHP:
http://example.com/yourfile.swf?random=<?php echo rand(); ?>
Upvotes: 0