Packageorg.osflash.signals.natives
Classpublic class NativeRelaySignal
InheritanceNativeRelaySignal Inheritance Signal Inheritance OnceSignal Inheritance Object
Implements INativeDispatcher
Subclasses NativeMappedSignal

The NativeRelaySignal class is used to relay events from an IEventDispatcher to listeners. The difference as compared to NativeSignal is that NativeRelaySignal has its own dispatching code, whereas NativeSignal uses the IEventDispatcher to dispatch.

Default MXML PropertyvalueClasses



Public Properties
 PropertyDefined By
  eventClass : Class
The class of event permitted to be dispatched.
NativeRelaySignal
  eventType : String
The type of event permitted to be dispatched.
NativeRelaySignal
 InheritednumListeners : uint
[read-only] The current number of listeners for the signal.
OnceSignal
  target : IEventDispatcher
The object considered the source of the dispatched events.
NativeRelaySignal
  valueClasses : Array
[override]
NativeRelaySignal
Protected Properties
 PropertyDefined By
  _eventClass : Class
NativeRelaySignal
  _eventType : String
NativeRelaySignal
 Inheritedslots : SlotList
OnceSignal
  _target : IEventDispatcher
NativeRelaySignal
 Inherited_valueClasses : Array
OnceSignal
Public Methods
 MethodDefined By
  
NativeRelaySignal(target:IEventDispatcher, eventType:String, eventClass:Class = null)
Creates a new NativeRelaySignal instance to relay events from an IEventDispatcher.
NativeRelaySignal
  
add(listener:Function):ISlot
[override] Subscribes a listener for the signal.
NativeRelaySignal
  
addOnce(listener:Function):ISlot
[override] Subscribes a one-time listener for this signal.
NativeRelaySignal
  
addOnceWithPriority(listener:Function, priority:int = 0):ISlot
Subscribes a one-time listener for this signal.
NativeRelaySignal
  
addWithPriority(listener:Function, priority:int = 0):ISlot
Subscribes a listener for the signal.
NativeRelaySignal
  
dispatch(... valueObjects):void
[override] Dispatches an object to listeners.
NativeRelaySignal
  
dispatchEvent(event:Event):Boolean
Unlike other signals, NativeRelaySignal does not dispatch null because it causes an exception in EventDispatcher.
NativeRelaySignal
  
remove(listener:Function):ISlot
[override] Unsubscribes a listener from the signal.
NativeRelaySignal
  
removeAll():void
[override] Unsubscribes all listeners from the signal.
NativeRelaySignal
Protected Methods
 MethodDefined By
  
onNativeEvent(event:Event):void
NativeRelaySignal
 Inherited
registerListener(listener:Function, once:Boolean = false):ISlot
OnceSignal
  
registerListenerWithPriority(listener:Function, once:Boolean = false, priority:int = 0):ISlot
NativeRelaySignal
 Inherited
registrationPossible(listener:Function, once:Boolean):Boolean
OnceSignal
Property Detail
_eventClassproperty
protected var _eventClass:Class

_eventTypeproperty 
protected var _eventType:String

_targetproperty 
protected var _target:IEventDispatcher

eventClassproperty 
eventClass:Class

The class of event permitted to be dispatched. Will be flash.events.Event or a subclass.


Implementation
    public function get eventClass():Class
    public function set eventClass(value:Class):void
eventTypeproperty 
eventType:String

The type of event permitted to be dispatched. Corresponds to flash.events.Event.type.


Implementation
    public function get eventType():String
    public function set eventType(value:String):void
targetproperty 
target:IEventDispatcher

The object considered the source of the dispatched events.


Implementation
    public function get target():IEventDispatcher
    public function set target(value:IEventDispatcher):void
valueClassesproperty 
valueClasses:Array[override]


Implementation
    public function get valueClasses():Array
    public function set valueClasses(value:Array):void
Constructor Detail
NativeRelaySignal()Constructor
public function NativeRelaySignal(target:IEventDispatcher, eventType:String, eventClass:Class = null)

Creates a new NativeRelaySignal instance to relay events from an IEventDispatcher.

Parameters
target:IEventDispatcher — An object that implements the flash.events.IEventDispatcher interface.
 
eventType:String — The event string name that would normally be passed to IEventDispatcher.addEventListener().
 
eventClass:Class (default = null) — An optional class reference that enables an event type check in dispatch(). Because the target is an IEventDispatcher, eventClass needs to be flash.events.Event or a subclass of it.
Method Detail
add()method
override public function add(listener:Function):ISlot

Subscribes a listener for the signal.

Parameters

listener:Function — A function with arguments that matches the value classes dispatched by the signal. If value classes are not specified (e.g. via Signal constructor), dispatch() can be called without arguments.

Returns
ISlot — a ISlot, which contains the Function passed as the parameter

Throws
flash.errors:IllegalOperationError IllegalOperationError: You cannot addOnce() then add() the same listener without removing the relationship first.
 
ArgumentError ArgumentError: Given listener is null.
 
ArgumentError ArgumentError: Target object cannot be null.
addOnce()method 
override public function addOnce(listener:Function):ISlot

Subscribes a one-time listener for this signal. The signal will remove the listener automatically the first time it is called, after the dispatch to all listeners is complete.

Parameters

listener:Function — A function with arguments that matches the value classes dispatched by the signal. If value classes are not specified (e.g. via Signal constructor), dispatch() can be called without arguments.

Returns
ISlot — a ISlot, which contains the Function passed as the parameter

Throws
flash.errors:IllegalOperationError IllegalOperationError: You cannot addOnce() then add() the same listener without removing the relationship first.
 
ArgumentError ArgumentError: Given listener is null.
 
ArgumentError ArgumentError: Target object cannot be null.
addOnceWithPriority()method 
public function addOnceWithPriority(listener:Function, priority:int = 0):ISlot

Subscribes a one-time listener for this signal. The signal will remove the listener automatically the first time it is called, after the dispatch to all listeners is complete.

Parameters

listener:Function — A function with an argument that matches the type of event dispatched by the signal. If eventClass is not specified, the listener and dispatch() can be called without an argument.
 
priority:int (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.

Returns
ISlot — a ISlot, which contains the Function passed as the parameter

Throws
flash.errors:IllegalOperationError IllegalOperationError: You cannot addOnce() then add() the same listener without removing the relationship first.
 
ArgumentError ArgumentError: Given listener is null.
 
ArgumentError ArgumentError: Target object cannot be null.
addWithPriority()method 
public function addWithPriority(listener:Function, priority:int = 0):ISlot

Subscribes a listener for the signal. After you successfully register an event listener, you cannot change its priority through additional calls to add(). To change a listener's priority, you must first call remove(). Then you can register the listener again with the new priority level.

Parameters

listener:Function — A function with an argument that matches the type of event dispatched by the signal. If eventClass is not specified, the listener and dispatch() can be called without an argument.
 
priority:int (default = 0)

Returns
ISlot — a ISlot, which contains the Function passed as the parameter

Throws
flash.errors:IllegalOperationError IllegalOperationError: You cannot addOnce() then add() the same listener without removing the relationship first.
 
ArgumentError ArgumentError: Given listener is null.
 
ArgumentError ArgumentError: Target object cannot be null.
dispatch()method 
override public function dispatch(... valueObjects):void

Dispatches an object to listeners.

Parameters

... valueObjects — Any number of parameters to send to listeners. Will be type-checked against valueClasses.


Throws
ArgumentError ArgumentError: Event object expected.
 
ArgumentError ArgumentError: No more than one Event object expected.
 
ArgumentError ArgumentError: Target object cannot be null.
 
ArgumentError ArgumentError: Event object cannot be null.
 
ArgumentError ArgumentError: Event object [event] is not an instance of [eventClass].
 
ArgumentError ArgumentError: Event object has incorrect type. Expected [eventType] but was [event.type].
dispatchEvent()method 
public function dispatchEvent(event:Event):Boolean

Unlike other signals, NativeRelaySignal does not dispatch null because it causes an exception in EventDispatcher. Dispatches an event to listeners.

Parameters

event:Event — An instance of a class that is or extends flash.events.Event.

Returns
Boolean

Throws
ArgumentError ArgumentError: Target object cannot be null.
 
ArgumentError ArgumentError: Event object cannot be null.
 
ArgumentError ArgumentError: Event object [event] is not an instance of [eventClass].
 
ArgumentError ArgumentError: Event object has incorrect type. Expected [eventType] but was [event.type].
onNativeEvent()method 
protected function onNativeEvent(event:Event):void

Parameters

event:Event

registerListenerWithPriority()method 
protected function registerListenerWithPriority(listener:Function, once:Boolean = false, priority:int = 0):ISlot

Parameters

listener:Function
 
once:Boolean (default = false)
 
priority:int (default = 0)

Returns
ISlot
remove()method 
override public function remove(listener:Function):ISlot

Unsubscribes a listener from the signal.

Parameters

listener:Function

Returns
ISlot — a ISlot, which contains the Function passed as the parameter
removeAll()method 
override public function removeAll():void

Unsubscribes all listeners from the signal.