A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [help] forcing a browser to over-write cached swf?

  1. #1
    curiouser and curiouser LittleRed's Avatar
    Join Date
    Mar 2004
    Location
    Nottingham
    Posts
    335

    [help] forcing a browser to over-write cached swf?

    hi

    I've wanted to do some special events type thing in my rpg (just been playing World of Warcraft and their Lunar Festival and Valentine's Special Events got me thinking... )
    Normally I want all of my swfs to be cached to save download time, but if one map has a special event, I'd need to make sure that the new swf with the special event graphics in is the one used by the browser. Is there a way to set specific files to be updated?
    (I know you can use a query string with the time in to *always* prevent a swf being cached, but most of the time I do want them to be cached)
    I can't see a way to do this, but there might be a clever way.
    (I'm using php as well, so if there's some kind of server-side trick I can use for individual files, then great)
    thanks for any help!

  2. #2
    CostomJunky Xploder's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    635
    Yeah I just ran into caching problems myself because I split the whole game into different swf files eg. main.swf, menu.swf, and game.swf where main.swf is the one that loads up the other ones. But this way the other swf files don't get updated even when I overwrite them with new parts. The only way I can do that is to go to the seperate swf files and refresh them .
    Last edited by Xploder; 02-15-2006 at 07:13 PM.

  3. #3
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    just do

    var url = 'myswf.swf'
    if ( useSpecialEvent ) {
    url += new Date().getTime()
    }

    loadMovie ( url )


    so if you have a special event, a new movie will be loaded, if not, it will try and load a file that may have been cached; if not, it will get cached when loaded

  4. #4
    curiouser and curiouser LittleRed's Avatar
    Join Date
    Mar 2004
    Location
    Nottingham
    Posts
    335
    Trickman - thanks - I could set a 'useSpecialEvent' variable in the xml data for each map which doesn't get cached, and then use your code.

  5. #5
    Official Shoe Shiner thehumanchimp's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    953
    you will never be able to stop anyone from getting the cached swf. Firefox for one will cache it even with query strings AFAIK. When i renamed the swf and put a blank one in its place it did not overwrite the original, just created another file.
    Message on a gravestone: I finished before you in the human race.

    Using: Flash MX

  6. #6
    curiouser and curiouser LittleRed's Avatar
    Join Date
    Mar 2004
    Location
    Nottingham
    Posts
    335
    ok - that's good to know, thanks.

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