loading movies in flash

Out of context: Reply #1

  • Started
  • Last post
  • 1 Response
  • caseyc0

    Anything you load will cache as expected when viewing it over http in a web browser. This is mostly a good thing but can be tricky when there are things you want to update. IE on windows likes to hold on to things indefinitely so if you update a swf, jpg, xml file etc who knows when the user will see it on the other end.

    There are 2 main solutions to this, if you have things that you will be updating manually use a url param when requesting files such as:

    loadMovie("myFile.swf?version=2...

    And if you have something that is dynamically generated use something like this, so it will always load the newest version:

    var nocache = new Date.getTime();
    myXML.load("myData.php?"+nocache...

    You should really keep all your paths in an xml file so you can change them without cracking open the main swf all the time. And remember to do the method I mentioned first to version that as well as versioning the main swf in the html embed code.

    One thing to note, when adding the query params to requests it's going to break when you view it locally so you also need a check somewhere to see if you are online, like this:

    _global.isOffline = (_url.indexOf("http://") == -1);

View thread