Packagecom.asfusion.mate.core
Classpublic class ListenerProxy

The ListenerProxy is used by the injector (via MateManager) to register to the dispatcher to listen to events and dispatch a new InjectorEvent each time the rules match. By default, ListenerProxy registers to listen the FlexEvent.COMPLETE using capture in the main display list. Once a new displayObject is created, a new InjectorEvent is created and dispached. The Injector will listen to that newly created event and will run the injection.



Protected Properties
 PropertyDefined by
  dispatcher : IEventDispatcher
Storage for the EventDispatcher that will be used to listen and dispatch events.
ListenerProxy
  registered : Boolean
Flag indicating if ListenerProxy is already listening for events
ListenerProxy
  type : String
Type used to register to events in the dispatcher object.
ListenerProxy
Public Methods
 MethodDefined by
  
ListenerProxy(dispatcher:IEventDispatcher)
ListenerProxy
  
addListener(type:String, typeWatcher:IEventDispatcher = null):void
addListener will register to listen to an event with the type that is passed as argument, using capture and priority one.
ListenerProxy
  
removeListener(type:String):void
Removes the listener from the dispatcher.
ListenerProxy
Protected Methods
 MethodDefined by
  
globalListenerProxyHandler(event:Event):void
Similar to the listenerProxyHandler with the difference that this handler will only run if the dispatcher is a GlobalDispatcher and the event happens in the popup display tree.
ListenerProxy
  
listenerProxyHandler(event:Event):void
Handler that will run every time an event is captured in our dispatcher.
ListenerProxy
  
Handler that will run every time the event type changes by calling the injectorSettings.
ListenerProxy
Property detail
dispatcherproperty
dispatcher:IEventDispatcher  [read-write]

Storage for the EventDispatcher that will be used to listen and dispatch events. This property is required in the constructor of this class.

Implementation
    protected function get dispatcher():IEventDispatcher
    protected function set dispatcher(value:IEventDispatcher):void
registeredproperty 
protected var registered:Boolean

Flag indicating if ListenerProxy is already listening for events

typeproperty 
protected var type:String

Type used to register to events in the dispatcher object.

Constructor detail
ListenerProxy()constructor
public function ListenerProxy(dispatcher:IEventDispatcher)Parameters
dispatcher:IEventDispatcher
Method detail
addListener()method
public function addListener(type:String, typeWatcher:IEventDispatcher = null):void

addListener will register to listen to an event with the type that is passed as argument, using capture and priority one. If the dispatcher is a GlobalDispatcher, we also register to listen events in the popup DiplayObject tree.

Parameters
type:String
 
typeWatcher:IEventDispatcher (default = null)
globalListenerProxyHandler()method 
protected function globalListenerProxyHandler(event:Event):void

Similar to the listenerProxyHandler with the difference that this handler will only run if the dispatcher is a GlobalDispatcher and the event happens in the popup display tree.

Parameters
event:Event
listenerProxyHandler()method 
protected function listenerProxyHandler(event:Event):void

Handler that will run every time an event is captured in our dispatcher. This handler will create a new InjectorEvent and will dispatch it from the dispatcher. That will make all the Injectors that are registered to listen for that class type run.

Parameters
event:Event
removeListener()method 
public function removeListener(type:String):void

Removes the listener from the dispatcher.

Parameters
type:String
typeChangeHandler()method 
protected function typeChangeHandler(event:InjectorSettingsEvent):void

Handler that will run every time the event type changes by calling the injectorSettings.

Parameters
event:InjectorSettingsEvent