Package | com.asfusion.mate.events |
Class | public class Listener |
Implements | flash.events.IEventDispatcher |
mate:Dispatcher
tag or class,
the registered listeners will be notified.
Property | Defined by | ||
---|---|---|---|
method : Function
Specifies the method to call when an event is received.
| Listener | ||
priority : int
(default = 0) — The priority level of the
Listener . | Listener | ||
type : String
The type attribute specifies the event type you want to listen to.
| Listener | ||
useWeakReference : Boolean
(default = true) — Determines whether the reference to the listener is strong or weak.
| Listener |
Property | Defined by | ||
---|---|---|---|
dispatcher : IEventDispatcher
Instance of an
IEventDispatcher to which this listener will be subscribed. | Listener | ||
methodRegistered : Boolean
Flag to mark if a method has been registerd
| Listener | ||
mxmlRegistered : Boolean
Flag to mark if an inline method has been registerd
| Listener | ||
tagEventType : String
Type of event that this class dispatches.
| Listener |
Method | Defined by | ||
---|---|---|---|
Listener()
Constructor
| Listener | ||
addEventListener(eventType:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = true):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
| Listener | ||
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
| Listener | ||
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
| Listener | ||
removeEventListener(eventType:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
| Listener | ||
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object
or any of its ancestors for the specified event type.
| Listener |
Method | Defined by | ||
---|---|---|---|
updateListeners(newType:String, oldType:String = null):void
Updates the listeners when the type changes.
| Listener |
Event | Summary | Defined by | ||
---|---|---|---|---|
The event that gets dispatched when an event of the type
specified in the type attribute is dispatched. | Listener |
dispatcher | property |
protected var dispatcher:IEventDispatcher
Instance of an IEventDispatcher
to which this listener will be subscribed.
method | property |
method:Function
[read-write]Specifies the method to call when an event is received. Called method will automatically receive the event.
Implementation public function get method():Function
public function set method(value:Function):void
methodRegistered | property |
protected var methodRegistered:Boolean
Flag to mark if a method has been registerd
mxmlRegistered | property |
protected var mxmlRegistered:Boolean
Flag to mark if an inline method has been registerd
priority | property |
priority:int
[read-write]
(default = 0) — The priority level of the Listener
.
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.
The default value is 0
.
public function get priority():int
public function set priority(value:int):void
tagEventType | property |
protected var tagEventType:String
Type of event that this class dispatches.
type | property |
type:String
[read-write]The type attribute specifies the event type you want to listen to.
The default value is null
.
public function get type():String
public function set type(value:String):void
useWeakReference | property |
useWeakReference:Boolean
[read-write](default = true) — 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. When using modules, it is recomended to use weak references to garbage-collect unused modules
The default value is true
.
public function get useWeakReference():Boolean
public function set useWeakReference(value:Boolean):void
Listener | () | constructor |
public function Listener()
Constructor
addEventListener | () | method |
public function addEventListener(eventType:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = true):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.
ParameterseventType:String |
|
listener:Function |
|
useCapture:Boolean (default = false )
|
|
priority:int (default = 0.0 )
|
|
useWeakReference:Boolean (default = true )
|
dispatchEvent | () | method |
public function dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow. The event target is the EventDispatcher object upon which dispatchEvent() is called.
Parametersevent:Event |
Boolean |
hasEventListener | () | method |
public function hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
This allows you to determine where an EventDispatcher object has altered handling of an event type
in the event flow hierarchy. To determine whether a specific event type will actually trigger an
event listener, use IEventDispatcher.willTrigger()
.
The difference between hasEventListener()
and willTrigger()
is that hasEventListener()
examines only the object to which it belongs, whereas willTrigger()
examines the entire event
flow for the event specified by the type parameter.
type:String |
Boolean |
removeEventListener | () | method |
public function removeEventListener(eventType:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.
ParameterseventType:String |
|
listener:Function |
|
useCapture:Boolean (default = false )
|
updateListeners | () | method |
protected function updateListeners(newType:String, oldType:String = null):void
Updates the listeners when the type changes. This method unregisters the old values and registers the new values.
ParametersnewType:String |
|
oldType:String (default = null )
|
willTrigger | () | method |
public function willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. This method returns true if an event listener is triggered during any phase of the event flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.
The difference between hasEventListener()
and willTrigger()
is that hasEventListener()
examines only the object to which it belongs, whereas willTrigger()
examines the entire event
flow for the event specified by the type parameter.
type:String |
Boolean |
receive | event |
*
The event that gets dispatched when an event of the type
specified in the type
attribute is dispatched.