Search code examples
javascriptflashswfobject

how do I run a downloaded flash object offline?


I saved all the files related to this magazine (in the proper folder structure, which I viewed from my cache): http://www.cbc.ca/heartland/features/mixed-media-magazine/mixed-media-magazine-1

The problem is, the swfobject.js file doesn't open. I get an error saying 'document' is undefined. And, when I open individual .swf files such as the page spreads, certain elements work (such as clicking on character profiles), but other elements such as certain backgrounds don't appear. So, my question is: how can I modify the files I have to get them to interact properly offline like they do online? If it's too complicated for a simple comment to answer, then any newbie-friendly references I can read up on would be a great help.


Solution

  • You wouldn't make one, but you link to a swfobject.js file and then configure it. I use an automatic code generator. It's just easier. I use this online version: http://www.bobbyvandersluis.com/swfobject/generator/index.html

    Also, use the google CDN if you can, then backup with a local version if it's not accessible for some reason. In practical terms that means putting this in the <head> of your document:

    <script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
    <script>swfobject || document.write('<script src="js/swfobject.js"><\/script>')</script> 
    

    The second line checks to see if swfobject is loaded, and if not, loads it from a local source, so make sure that you have a local copy in the src directory path.