3 Replies Latest reply on Apr 13, 2013 8:15 AM by ASWC

    loader error catch when a resource is not avaliable

    PastaPrimavera

      I am trying to know when i try to request a file and there is no responce.  I assumed that when it tried to get the file and could not it would throw an error but this code does not work when i make the file unavaliable to get..

       

       

      var loader:Loader = new Loader();

      loader.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);

      loader.load( new URLRequest('http://get_my_file/image.jpg' ) );

       

      private function uncaughtErrorHandler(event:UncaughtErrorEvent):void

      {

          if (event.error is Error)

          {

              trace("Error 1");

          }

          else if (event.error is ErrorEvent)

          {

              trace("Error 2");

          }

          else

          {

              trace("Error 3");

          }

      }