EventDispatcher
EventDispatcher object
The EventDispatcher object is the base class for all objects that dispatch events. The EventDispatcher object allows any object on the display list to be an event target and as such, to use the listed below methods:
addEventListener(type, listener, useCapture, priority, useWeakReference) |
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. |
type - the type of event, string listener - the listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing useCapture - (recommended default = false) - Determines whether the listener works in the capture phase or the target and bubbling phases. If useCapture is set to true, the listener processes the event only during the capture phase and not in the target or bubbling phase. If useCapture is false, the listener processes the event only during the target or bubbling phase. To listen for the event in all three phases, call addEventListener twice, once with useCapture set to true, then again with useCapture set to false. priority - (recommended default = 0) - The priority level of the event listener. The priority is designated by a signed 32-bit integer. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0. useWeakReference - (recommended default = false) - Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected. A weak reference does not |
dispatchEvent(event) |
Dispatches an event into the event flow. |
event - Event object |
hasEventListener(type) |
Checks whether the EventDispatcher object has any listeners registered for a specific type of event. |
type - the type of event, string |
removeEventListener(type, listener, capture) |
Removes a listener from the EventDispatcher object. |
type - the type of event, string listener - The listener object to remove. capture - (recommended default = false) - Specifies whether the listener was registered for the capture phase or the target and bubbling phases. If the listener was registered for both the capture phase and the target and bubbling phases, two calls to removeEventListener() are required to remove both, one call with useCapture() set to true, and another call with useCapture() set to false. |
toString() |
return object as string representation |
|
willTrigger(type) |
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. |
type - the type of event, string |
Created with the Personal Edition of HelpNDoc: Easy to use tool to create HTML Help files and Help web sites