Thursday, May 26, 2011

AS3 Signals - Faster Messages in AS3

AS3 signals are free , very fast and relaible messaging tool, i have been using them from last 6 months , below are some features of Signals which are more superior than Events

Dowload it from

Signal's Salient Features

Remove all event listeners : signal.removeAll();

Retrieve the number of listeners : signal.numListeners

Listeners can be added for a one-time call and removed automatically on dispatch:

signal.addOnce(theListener); // result: signal has one listener
signal.dispatch(theEvent); // result: theListener is called, signal now has no listeners

A Signal can be initialized with value classes that will validate value objects on dispatch (optional):

// A Signal that will dispatch a String and an integer:
progress = new Signal(String, int);
progress.dispatch(); // will throw ArgumentError
progress.dispatch('The Answer'); // will throw ArgumentError
progress.dispatch('The Answer', 42.5); // will throw ArgumentError
progress.dispatch('The Answer', 42); // will succeed

Varun Rathore

No comments:

About Me