A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Caching fixed (Er, patched)

  1. #1
    Join Date
    Feb 2002

    Caching fixed (Er, patched)

    Greetings all,

    being as browser caching is a common problem, I thought I would send a quick post to let everyone know that I have released my antiCache function in the code snippets section of my site:


    The quick overview:
    Appends a random number to the end of a url only if the current swf is being accessed via the web, to prevent loading cached files.
    If the AllowCache parameter is true then the number is stored, and applied to subsequent requests for the same file during the current session. This allows it to load the file fresh each session, but cache it for the duration of that session.

    // example 1:
    my_xml.load(antiCache("myUrl.php?value=20",false)) ;
    // will load myUrl.php?value=20&antiCache=12345x12345

    // example 2:
    // will load myUrl.swf?antiCache=12345x12345

    I believe it is also easy to extend existing methods to use it automatically. I haven't actually tested it, but you should be able to do something along the lines of:

    MovieClip.prototype.$loadMovie = MovieClip.prototype.loadMovie;
    MovieClip.prototype.loadMovie = function(fUrl,fMethod) {

    Hope it helps people! It's been extremely useful on my site (the site wouldn't have been possible without it due to caching problems).

    Grant Skinner.
    http://gskinner.com/ - Flash application development and source code
    http://gmodeler.com/ - free online uml diagramming and documentation tool

    Team Macromedia Voluteer for Flash.

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    San Francisco, CA (USA)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center