package { import flash.events.Event; /** * This custom Event class adds a message property to a basic Event. */ public class actionscript_book_AlarmClock_com_example_programmingas3_clock_AlarmEvent extends Event { /** * The name of the new actionscript_book_AlarmClock_com_example_programmingas3_clock_AlarmEvent type. */ public static const ALARM:String = "alarm"; /** * A text message that can be passed to an event handler * with this event object. */ public var message:String; /** * Constructor. * @param message The text to display when the alarm goes off. */ public function actionscript_book_AlarmClock_com_example_programmingas3_clock_AlarmEvent(message:String = "ALARM!") { super(ALARM); this.message = message; } /** * Creates and returns a copy of the current instance. * @return A copy of the current instance. */ public override function clone():Event { return new actionscript_book_AlarmClock_com_example_programmingas3_clock_AlarmEvent(message); } /** * Returns a String containing all the properties of the current * instance. * @return A string representation of the current instance. */ public override function toString():String { return formatToString("actionscript_book_AlarmClock_com_example_programmingas3_clock_AlarmEvent", "type", "bubbles", "cancelable", "eventPhase", "message"); } } }