2 Replies Latest reply on Aug 15, 2007 8:21 AM by SymTsb

    Flash CS3 URLLoader / Caching

    SymTsb Level 2
      I'm working on sending and receiving data from a PHP script. The task is pretty much just a matter of updating the code to bring it from AS2 to AS3 compliance. I've rewritten the code that sends and receives the data and it appears to be working just fine at this point. The problem I appear to be having is a caching issue. I'm making small mods to the php file now to address variable pair issues.

      In AS2 you would use echo("&variable=".$value); in your PHP file to get the data to output. In AS3, I've had to update each echo statement so that it looks like this...

      echo "variable=$value";

      This isn't a huge issue and relatively minor in my opinion. When I make the updates necessary, upload my PHP file and test again inside the environment, Flash outputs (via trace) the older &variable= style pairs instead of the expect variable= style which is inside the new PHP file. I test the php file from the web server and it outputs the variable= style. I shutdown Flash and restart and sure enough, it now receives the variable=value style.

      This makes me believe that Flash is caching the PHP file and this is causing grief for me. Unfortunately, I'm now having issues with Flash not receiving the variable data that I'd expect (although the data is echoing out from the php file when tested alone) and so I'm trying to make changes to the PHP file to address CS3/AS3s new format requirements but Flash simply spits out the exact data every time. I've gone as far as to add extra lines into the PHP with odd echo calls just to see if Flash returns this information and I'm still getting the cached results.

      Does CS3/AS3 cache URLRequest calls/results??? I don't want to keep restarting Flash to get it to dump it either which is the only thing I see that is working at the moment. Any help is appreciated. Maybe there is a problem with my code so I've attached the block necessary for communicating with my php file.

        • 1. Flash CS3 URLLoader / Caching
          Juankpro Level 2
          Flash, always caches data. At least that was the behavior in earlier versions of Flash. Data was not cached only when testing from the authoring environment. But as I see the new Flash environment is caching too as the Player and Activex versions have always done.

          To avoid caching there a technique called "cache killer". It consist on passing a random number as a GET parameter to the request. This way the page is considered as been different (because of the random name) and not cached.

          change you "php/pc3.php" string to:

          "php/pc3.php?cacheKiller=" + (new Date()).getTime()
          • 2. Re: Flash CS3 URLLoader / Caching
            SymTsb Level 2
            Thanks for the input. I've always used the cacheKiller method to deal with caching inside the browser but until CS3 had not experienced the same problems with the run time environment. Now that I know, I'll just do this all from the get go.