| Package | system.signals |
| Class | public class Signal |
| Inheritance | Signal InternalSignal Object |
| Subclasses | Logger |
Example :
package examples
{
import system.signals.Signal ;
import flash.display.Sprite;
import flash.events.Event;
[SWF(width="740", height="480", frameRate="24", backgroundColor="#666666")]
public class SignalExample extends Sprite
{
public function SignalExample()
{
var signal:Signal = new Signal() ;
signal.connect( write ) ;
signal.emit( "hello world" ) ; // hello world
signal.emit( "thank you" ) ; // thank you
}
public function write( message:String ):void
{
trace( message ) ;
}
}
}
| Method | Defined By | ||
|---|---|---|---|
Signal(types:Array = null, receivers:Array = null)
Creates a new Signal instance. | Signal | ||
![]() | checkValues(values:Array):void
Checks all values passed-in the emit method. | InternalSignal | |
![]() | connect(receiver:*, priority:uint = 0, autoDisconnect:Boolean = false):Boolean
Connects a Function or a Receiver object. | InternalSignal | |
![]() | connected():Boolean
Returns true if one or more receivers are connected. | InternalSignal | |
![]() | disconnect(receiver:* = null):Boolean
Disconnect the specified object or all objects if the parameter is null. | InternalSignal | |
emit(... values):void [override]
Emit the specified values to the receivers. | Signal | ||
![]() | hasReceiver(receiver:*):Boolean
Returns true if the specified receiver is connected. | InternalSignal | |
![]() | toArray():Array
Returns the Array representation of all receivers connected with the signal. | InternalSignal | |
![]() | toVector():Vector.<Function>
Returns the Vector representation of all receivers connected with the signal. | InternalSignal | |
| Signal | () | Constructor |
public function Signal(types:Array = null, receivers:Array = null)Creates a new Signal instance.
Parameterstypes:Array (default = null) — An optional Array who contains any number of class references that enable type checks in the "emit" method.
If this argument is null the "emit" method not check the types of the parameters in the method.
| |
receivers:Array (default = null) — The Array collection of receiver objects to connect with this signal.
|
| emit | () | method |
override public function emit(... values):voidEmit the specified values to the receivers.
Parameters
... values — All values to emit to the receivers.
|