In AS 3.0 you can now create your own Events that extends the Event class.
[as]package.events
{
public class CustomEvent extends Event
{
public static const CUSTOM_TYPE:String = “customType”;
public var customProp:String;
public function CustomEvent( type:String, cp:String, bubbles:Boolean, cancelable:Boolean )
{
super( type, bubbles, cancelable )
customProp = cp;
}
}
}[/as]
This can then be used like so
[as]dispatchEvent( new CustomEvent( CustomEvent.CUSTOM_TYPE, “myProp”, true ) );[/as]
This works fine until you need to re-dispatch the event, in the case that you event doesn’t bubble as its dispatched from an object that isn’t in a displayList. If you do re-dispatch the event like so…
(more…)