1package ru.dfls.events { 2 import flash.events.Event; 3 import flash.events.ErrorEvent; 4 5 /** 6 * This event is usually dispatched if some error was thrown from an asynchronous code, i.e. there 7 * is no relevant user stack part to process the error. There is only one type of such event: 8 * <code>ErrorEvent.ERROR</code> which is same as <code>flash.events.ErrorEvent.ERROR</code>. 9 * The only difference between <code>flash.events.ErrorEvent</code> and 10 * <code>ru.dfls.events.ErrorEvent</code> is the capability of the latter to store the underlying cause 11 * (the <code>Error</code>). 12 * 13 * @see flash.events.ErrorEvent 14 * @see Error 15 * @author dragonfly 16 */ 17 public class ErrorEvent extends flash.events.ErrorEvent { 18 19 public static var ERROR : String = flash.events.ErrorEvent.ERROR; 20 21 private var _error : Error; 22 23 public function ErrorEvent(type : String, bubbles : Boolean = false, cancelable : Boolean = false, 24 text : String = "", error : Error = null) { 25 super(type, bubbles, cancelable, text); 26 _error = error; 27 } 28 29 public function get error() : Error { 30 return _error; 31 } 32 33 public function set error(value : Error) : void { 34 _error = value; 35 } 36 37 public override function toString() : String { 38 return formatToString("ErrorEvent", "type", "bubbles", "cancelable", "eventPhase", "text", "error"); 39 } 40 41 public override function clone() : Event { 42 return new ru.dfls.events.ErrorEvent(type, bubbles, cancelable, text, error); 43 } 44 45 } 46} 47