4 Replies Latest reply on Oct 15, 2007 3:44 PM by chopTheWood

    Listening for a php script to load a directory

    chopTheWood Level 1
      I'm trying to get the script to listen and wait for the php file to load a directory listing and then for a Flash script to sort the directory listing alphabetically and place it in a text field. It works if I give it 10 frames worth of time, but I don't want anything else to happen before it has finished. And I don't want to give it time by adding frames. I tried using an Interval approach but couldn't get it to work. ????

      loadVariablesNum("php/listfilesMod2.php", 0);


      //--- php script
      <?
      $dir_name = "/home/jmthieme/public_html/flashRev7/artText";

      $dir = opendir($dir_name);


      while ($file_name = readdir($dir)) {
      if (($file_name != ".") && ($file_name != "..")) {

      $file_list .= "$file_name";
      $file_list .= ",";
      }
      }


      closedir($dir);

      $theListing="&theFileList=";
      $theListing.="$file_list";
      echo "$theListing";

      ?>




      //------- related example from Flash Help on using Interval

      loadVariablesNum("params.txt", 2);
      function checkParamsLoaded() {
      if (_level2.done == undefined) {
      trace("not yet.");
      } else {
      trace("finished loading. killing interval.");
      trace("-------------");
      for (i in _level2) {
      trace(i+": "+_level2 );
      }
      trace("-------------");
      clearInterval(param_interval);
      }
      }
      var param_interval:Number = setInterval(checkParamsLoaded, 100);

      // Params.txt includes the following text
      var1="hello"&var2="goodbye"&done="done"