Package | org.osflash.signals |
Class | public class Signal |
Inheritance | Signal ![]() ![]() |
Implements | ISignal |
Default MXML PropertyvalueClasses
Method | Defined By | ||
---|---|---|---|
Signal(... valueClasses)
Creates a Signal instance to dispatch value objects. | Signal | ||
Subscribes a listener for the signal. | Signal | ||
![]() |
Subscribes a one-time listener for this signal. | OnceSignal | |
![]() | dispatch(... valueObjects):void
Dispatches an object to listeners. | OnceSignal | |
![]() |
Unsubscribes a listener from the signal. | OnceSignal | |
![]() | removeAll():void
Unsubscribes all listeners from the signal. | OnceSignal |
Signal | () | Constructor |
public function Signal(... valueClasses)
Creates a Signal instance to dispatch value objects.
Parameters... valueClasses — Any number of class references that enable type checks in dispatch().
For example, new Signal(String, uint)
would allow: signal.dispatch("the Answer", 42)
but not: signal.dispatch(true, 42.5)
nor: signal.dispatch()
NOTE: In AS3, subclasses cannot call super.apply(null, valueClasses),
but this constructor has logic to support super(valueClasses).
|
add | () | method |
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.
|
ISlot — a ISlot, which contains the Function passed as the parameter
|
flash.errors:IllegalOperationError — IllegalOperationError : You cannot addOnce() then add() the same listener without removing the relationship first.
| |
ArgumentError — ArgumentError : Given listener is null .
|