Main Page | Packages | Class Tree | Index | Help

xp.events

class EventDispatcher

Object
  |
  +--xp.events.EventDispatcher

Implemented Interfaces: IDispatcher

class EventDispatcher
extends Object

EventDispatcher


Author:
ProWin Computers Ltd. - Rob Edgar

Version:
3.0.0.000

See also:


Field Summary

public static
dispatcher: EventDispatcher
The global static default dispatcher

Constructor

public
EventDispatcher ( )
Constructs a new Dispatcher instance.

Method Summary

public
addEventListener ( target: Object, event: String, handler: Object, method: Object, tag: String ): Void
Add a listener for a particular event

public
dispatchEvent ( target: Object, e: Event ): Void
dispatch the event to all listeners

public
removeEventListener ( target: Object, event: String, handler: Object, tag: String, all: Boolean ): Void
remove a listener for a particular event



Field Documentation

dispatcher

public static var dispatcher: EventDispatcher
The global static default dispatcher


Constructor Documentation

EventDispatcher

public function EventDispatcher()
Constructs a new Dispatcher instance.

Generally the static default dispatcher is used instead of creating a new one


Method Documentation

addEventListener

public function addEventListener(target: Object,
 event: String,
 handler: Object,
 method: Object,
 tag: String): Void
Add a listener for a particular event

Registers a listener object with a component instance that is broadcasting an event.
When the event occurs, the listener object or function is notified.
You can call this method from any component instance.
For example, the following code registers a listener to the component instance myButton: myButton.addEventListener("click", myListener);

Specified by:

Parameters:
target
event
The name of the event ("click", "change", etc) if null will assume "*" and listen to all events
handler
The handler object that the function be invoked on
method
The function that should be called
tag
An optional tag to identify anonymous listeners

dispatchEvent

public function dispatchEvent(target: Object,
 e: Event): Void
dispatch the event to all listeners

Dispatches an event to any listener registered with an instance of the class.
This method is usually called from within a component’s class file.
For example, the SimpleButton.as class file dispatches the click event.

Specified by:

Parameters:
target
the object instance raising the event
e
an Event or one of its subclasses describing the event

removeEventListener

public function removeEventListener(target: Object,
 event: String,
 handler: Object,
 tag: String,
 all: Boolean): Void
remove a listener for a particular event

Specified by:

Parameters:
target
event
the name of the event ("click", "change", etc) if null will assume all(*) events
handler
the handler object that the function be invoked on
tag
flag to remove all listeners
all

The documentation was generated from the following file:


Generated on 10/30/2005 9:34:02 PM by AS2Doc