loading movies in flash

  • Started
  • Last post
  • 1 Response
  • lw-d

    Hi all,

    I have external movies loading into my main flash file. When I simiuate say a 56k download in flash, it seems to have to load the movie each time as oppose to load it once then retrieve it. Is this how flash works, its there something I have doing wrong or will it not be like this online?

    Thanks

  • 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);