EventDispatcher class

The base class for all classes that dispatch events.

The EventDispatcher class is the base class for the DisplayObject class. The EventDispatcher class allows any object on the display list to be an event target.

Event targets are an important part of the StageXL event model. The event target serves as the focal point for how events flow through the display list hierarchy. When an event such as a mouse click or a keypress occurs, the application dispatches an event object into the event flow from the root of the display list. The event object then makes its way through the display list until it reaches the event target, at which point it begins its return trip through the display list. This round-trip journey to the event target is conceptually divided into three phases:

  • the capture phase comprises the journey from the root to the last node before the event target's node,
  • the target phase comprises only the event target node, and
  • the bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the display list.

In general, the easiest way for a user-defined class to gain event dispatching capabilities is to extend EventDispatcher. If this is impossible (that is, if the class is already extending another class), you can instead use the EventDispatcher as a mixin.





hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


addEventListener<T extends Event>(String eventType, EventListener<T> eventListener, {bool useCapture = false, int priority = 0}) StreamSubscription<T>
Adds an event listener to receive events.
dispatchEvent(Event event) → void
Dispatches the event to all listening subscribers.
dispatchEventRaw(Event event, EventDispatcher target, EventPhase eventPhase) → void
Do not use the dispatchEventRaw method unless you want to override the way how events are dispatched for display list object. Please use dispatchEvent instead.
hasEventListener(String eventType, {bool useCapture = false}) bool
Returns true if the EventDispatcher has event listeners. The useCapture paramenter defines if the event listeners should be registered for the capturing event phase or not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
on<T extends Event>(String eventType) EventStream<T>
Returns an event stream of type eventType.
removeEventListener<T extends Event>(String eventType, EventListener<T> eventListener, {bool useCapture = false}) → void
Removes an event listener to stop receiving events.
removeEventListeners(String eventType) → void
Removes all event listeners of a given event type.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.