EventDispatcher
| Kind of class: | class |
|---|---|
| Inherits from: | CoreObject |
| Implements: | |
| Known subclasses: | |
| Version: | 12/18/06 |
| Author: | Aaron Clinger |
| Classpath: | org.casaframework.event.EventDispatcher |
| File last modified: | Monday, 08 January 2007, 09:57:51 |
Provides event notification and listener management capabilities to objects.
Advantages of using this EventDispatcher:
- Ability to remap event handlers to a function not sharing the same name as the event.
- Ability to remove all event observers for a specified event.
- Ability to remove all event observers for a specified scope.
- Ability to remove all event observers subscribed to broadcasting object.
Usage note:
Always call destroy before deleting/removing an EventDispatcher instance.
Summary
Constructor
Instance properties
Instance properties inherited from CoreObject
Instance methods
- addEventObserver
- removeEventObserver
- removeEventObserversForEvent
- removeEventObserversForScope
- removeAllEventObservers
- dispatchEvent
- destroy
Instance methods inherited from CoreObject
Constructor
EventDispatcher
function EventDispatcher (
)
Instance methods
addEventObserver
function addEventObserver (
scope:Object,
eventName:String,
eventHandler:String) : Boolean
Registers a function to receive notification when a event handler is invoked.
#destroy
function destroy (
) : Void
Removes internal variables, intervals, enter frames, internal MovieClips and event observers to allow the object to be garbage collected.
Always call
#Always call
destroy() before deleting/removing object instance.Specified by:
dispatchEvent
function dispatchEvent (
eventName:String) : Boolean
Reports event to all subscribed objects.
#removeAllEventObservers
function removeAllEventObservers (
) : Boolean
Removes all observers regardless of scope or event.
return Returns
#return Returns
true if observers were successfully removed; otherwise false.Specified by:
removeEventObserver
function removeEventObserver (
scope:Object,
eventName:String,
eventHandler:String) : Boolean
Removes specific observer for event.
#Returns:
Returns
#true if the observer was successfully found and removed; otherwise false.Specified by:
removeEventObserversForEvent
function removeEventObserversForEvent (
eventName:String) : Boolean
Removes all observers for a specified event.
#removeEventObserversForScope
function removeEventObserversForScope (
scope:Object) : Boolean
Removes all observers in a specified scope.
#