9 Replies Latest reply on Nov 14, 2012 7:31 AM by sinious

    Make a flash not to cache in browser

    jfha710

      Hey guys,

       

      I'm trying to make a flash picture galley not to cache using the popular methods:

       

      <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
      <META HTTP-EQUIV="Expires" CONTENT="-1">

       

      But it keeps caching, so I was wondering if I can make it not to cache form the .swf (.fla) file itself?

       

      Thanks.

        • 1. Re: Make a flash not to cache in browser
          kglad Adobe Community Professional & MVP

          in your embed and object tags, append a changing variable to your swf file name.  for example:

           


          <body>


          <script type="text/javascript">



          var randomNum = Math.random();


          </script>


          <div id="flashContent">



          <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="test1" align="middle">




          <param name="movie" value="test1.swf?nocache="+randomNum />




          <param name="quality" value="high" />




          <param name="bgcolor" value="#ffffff" />




          <param name="play" value="true" />




          <param name="loop" value="true" />




          <param name="wmode" value="window" />




          <param name="scale" value="showall" />




          <param name="menu" value="true" />




          <param name="devicefont" value="false" />




          <param name="salign" value="" />




          <param name="allowScriptAccess" value="sameDomain" />




          <!--[if !IE]>-->




          <object type="application/x-shockwave-flash" data="test1.swf?nocache="+randomNum width="550" height="400">





          <param name="movie" value="test1.swf?nocache="+randomNum />





          <param name="quality" value="high" />





          <param name="bgcolor" value="#ffffff" />





          <param name="play" value="true" />





          <param name="loop" value="true" />





          <param name="wmode" value="window" />





          <param name="scale" value="showall" />





          <param name="menu" value="true" />





          <param name="devicefont" value="false" />





          <param name="salign" value="" />





          <param name="allowScriptAccess" value="sameDomain" />




          <!--<![endif]-->





          <a href="http://www.adobe.com/go/getflash">






          <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />





          </a>




          <!--[if !IE]>-->




          </object>




          <!--<![endif]-->



          </object>


          </div>

          </body>
          • 2. Re: Make a flash not to cache in browser
            jfha710 Level 1

            I tried adding ?nocache=randomnum and movie.swf?randomnum and neither worked.

            • 3. Re: Make a flash not to cache in browser
              kglad Adobe Community Professional & MVP

              copy and paste your html.

              • 4. Re: Make a flash not to cache in browser
                sinious Most Valuable Participant

                Are you downloading a picture feed from something else cachable like a flikr feed in XML?

                • 5. Re: Make a flash not to cache in browser
                  jfha710 Level 1

                  Yes, only this is from flashxml.net it's called banner-rotator.

                  • 6. Re: Make a flash not to cache in browser
                    sinious Most Valuable Participant

                    Check the data being returned, see if it's the same. That's probably going to need something similar to what's mentioned above (making the URL unique) to force XML not to cache. flashxml.net/some/path/to/my.xml?seed=123837923749 .. That kind of thing. Browsers love to cache XML, SWF, images, etc.

                    • 7. Re: Make a flash not to cache in browser
                      jfha710 Level 1

                      Here is the thing:

                       

                      The banner rotator calls a file called settings.xml (same folder as the swf), this xml calls another xml called images.xml (also same folder as swf) to load the images, which one do I have to add the random number to? settings.xml, or images.xml?

                       

                      settings.xml is called from the swf file, so for that I can use flash code, but images is called from settings, how can I put a random number on an XML file if I need to put it in the images?

                       

                      Also, if I have to put it in the swf file, is it OK if I just add "?seed=".random(100000) or do I have to put an echo or a print before it?

                       

                      Thanks,

                      • 8. Re: Make a flash not to cache in browser
                        kglad Adobe Community Professional & MVP

                        your urlrequest should be something like:

                         

                        images.xml+"?seed="+Math.random();  // to load a non-cached images.xml

                         

                        settings.xml+"?seed="+Math.random();  // to load a non-cached settings.xml

                        • 9. Re: Make a flash not to cache in browser
                          sinious Most Valuable Participant

                          settings.xml is called from the swf file, so for that I can use flash code, but images is called from settings, how can I put a random number on an XML file if I need to put it in the images?

                           

                          Do you mean the images.xml file is listed in settings.xml and you're loading images.xml using an URLLoader inside the SWF? Or are you including the XML inside the other via entity?

                           

                          e.g.:

                          <?xml version="1.0" standalone="no" encoding="utf-8" ?>

                          <!DOCTYPE settings [

                          <!ENTITY imageFile SYSTEM "images.xml">

                          ]>

                          <settings>

                            <images>&imageFile;</images>

                          </settings>

                           

                          If you're doing entity, are there other systems that depend on it or can you simply convert it so the SWF loads both?