GODPAPER | All Packages | All Classes | Index | Frames No Frames |
NativeSignalSet

Package | org.osflash.signals.natives.sets
Class | public class NativeSignalSet
Inheritance | NativeSignalSet Object
Subclasses | EventDispatcherSignalSet

A convenient way to access a logical set of signals.

View the examples

Public Properties

| Property | Defined By
--- | --- | ---
|  | numListeners : int [read-only] The current number of listeners for the signal. | NativeSignalSet
|  | signals : Array [read-only] The signals in the SignalSet as an Array. | NativeSignalSet

Protected Properties

| Property | Defined By
--- | --- | ---
|  | target : IEventDispatcher | NativeSignalSet

Public Methods

| Method | Defined By
--- | --- | ---
|  | NativeSignalSet(target:IEventDispatcher) | NativeSignalSet
|  | getNativeSignal(eventType:String, eventClass:Class = null):NativeSignal Lazily instantiates a NativeSignal | NativeSignalSet
|  | removeAll():void Unsubscribes all listeners from all signals in the set. | NativeSignalSet

Protected Constants

| Constant | Defined By
--- | --- | ---
|  | _signals : Dictionary | NativeSignalSet

Property Detail

numListeners | property

`numListeners:int` [read-only]

The current number of listeners for the signal.

Implementation
`public function get numListeners():int`

signals | property |

`signals:Array` [read-only]

The signals in the SignalSet as an Array.

Implementation
`public function get signals():Array`

target | property |

`protected var target:IEventDispatcher`

Constructor Detail

NativeSignalSet | () | Constructor

`public function NativeSignalSet(target:IEventDispatcher)`

Parameters

| `target:IEventDispatcher`

Method Detail

getNativeSignal | () | method

`public function getNativeSignal(eventType:String, eventClass:Class = null):NativeSignal`

Lazily instantiates a NativeSignal

Parameters

| `eventType:String`
| `eventClass:Class` (default = `null`)``

Returns

| `NativeSignal`

Throws

| `ArgumentError` — `ArgumentError`: eventType must not be null.

removeAll | () | method |

`public function removeAll():void`

Unsubscribes all listeners from all signals in the set.

Constant Detail

_signals | Constant

`protected const _signals:Dictionary`

Examples
SignalSets allow you to get predefined signals for many built in events

            package {
                import org.osflash.signals.natives.sets.InteractiveObjectSignalSet;

                import flash.display.Sprite;
                import flash.events.Event;

                public class Example extends Sprite {

                    private var button:Sprite;
                    private var buttonSignals:InteractiveObjectSignalSet;

                    public function Main() {
                        button = new Sprite();
                        button.graphics.beginFill(0xff0000);
                        button.graphics.drawRect(0, 0, 100, 100);
                        button.graphics.endFill();

                        buttonSignals = new InteractiveObjectSignalSet(button);
                        buttonSignals.click.add(handler);
                        buttonSignals.addedToStage.add(handler);
                        buttonSignals.enterFrame.addOnce(handler);

                        addChild(button);
                    }

                    private function handler(event:Event):void {
                        trace(event.target, "fired", event.type);
                    }
                }
            }

Thu Jan 16 2014, 01:11 PM +08:00