1 Reply Latest reply on Aug 19, 2007 1:45 PM by ntsiii

    How to check if file on filesystem exists?

      Is there a way to check if an image, that I need to load dynamicaly, exists?
      If it doesn't I need to load another image, and so on...

      private function testImage(str:String):Boolean
      var bool:Boolean = false;
      //str = images/05_994_180.png -- doesn't exist
      var urlreq:URLRequest = new URLRequest(str);
      trace("loader -",str);
      bool = true;
      } catch(e:Error) {
      trace("error loading", str);
      bool = false;
      } finally {
      trace(" |--> loader = ",bool);
      return bool;

      But this always returns true, even if the image doesn't exist.