Событие:

Код AS3:
package {
import flash.events.Event;
/**
* ...
* @author HardCoder
*/
public final class SomeEvent extends Event {
public static const DO_SOMETHING:String = "doSomething";
private var _property_1:uint;
private var _property_2:Boolean;
public function SomeEvent(type:String, property_1:uint, property_2:Boolean, bubbles:Boolean = false, cancelable:Boolean = false){
super(type, bubbles, cancelable);
this._property_1 = property_1;
this._property_2 = property_2;
}
override public function clone():Event {
return new SomeEvent(this.type, this._property_1, this._property_2, this.bubbles, this.cancelable);
}
override public function toString():String {
return formatToString("SomeEvent", "property_1", "property_2", "type", "bubbles", "cancelable", "eventPhase");
}
public function get property_1():uint {
return this._property_1;
}
public function get property_2():Boolean {
return this._property_2;
}
}
}
Прослушивание:

Код AS3:
myObject.addEventListener(SomeEvent.DO_SOMETHING, myObjectHandler);
private function myObjectHandler(e:SomeEvent):void{
trace(e.property_1, e.property_2);
}
Диспетчеризация:

Код AS3:
private function onClick(e:Event):void {
this.dispatchEvent(new SomeEvent(SomeEvent.DO_SOMETHING, 1203, true));
}