Chapter 24 Example 5

by actionscriptbible
♥0 | Line 15 | Modified 2010-01-29 00:45:55 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6dL8
 */

package {
  import flash.display.Sprite;
  import flash.events.IOErrorEvent;
  import flash.events.UncaughtErrorEvent;
  public class ch24ex5 extends Sprite {
    public function ch24ex5() {
      loaderInfo.uncaughtErrorEvents.addEventListener(
        UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
    }
    protected function onUncaughtError(event:UncaughtErrorEvent):void {
      if (event.error is IOErrorEvent && event.error.errorID == 2036) {
        //the load never completed. this error will be silenced either way
        //since we subscribed to UNCAUGHT_ERROR; but this demonstrates
        //one way to identify events.
      }
    }
  }
}