ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > AsBroadcaster | |||
Object
|
+-AsBroadcaster
public class AsBroadcaster
extends Object
Provides event notification and listener management capabilities that you can add to user-defined objects. This class is intended for advanced users who want to create custom event handling mechanisms. You can use this class to make any object an event broadcaster and to create one or more listener objects that receive notification anytime the broadcasting object calls the broadcastMessage() method.
There is no constructor function for the AsBroadcaster class. To use this class, follow this process:
AsBroadcaster.initialize(obj:Object) method, where the obj parameter is the name of the object that you selected to be the broadcaster.myBroadcaster.addListener(myListener), where myBroadcaster is the name of the event broadcaster object and myListener is the name of the listener object. Each event broadcaster stores a list of listener objects to be notified when a message is broadcast. Use the addListener() method to add listeners to the list, and use removeListener() to remove listeners from the list.myBroadcaster.broadcastMessage(eventName:String) method, where myBroadcaster is the name of the event broadcaster and eventName is the name of the event that matches the name of the listener method.Note: A common mistake is to capitalize the second letter of AsBroadcaster. When calling the AsBroadcaster.initialize() method, ensure that the second letter is lowercase. Any misspelling of AsBroadcaster fails silently.
Availability: ActionScript 1.0; Flash Player 6
|
Modifiers |
Property |
Description |
|---|---|---|
|
_listeners |
A list of references to all registered listener objects. |
Properties inherited from class Object
constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)
|
Modifiers |
Signature |
Description |
|---|---|---|
|
addListener |
Registers an object to receive event notification messages. |
|
|
broadcastMessage |
Sends an event message to each object in the list of listeners. |
|
|
|
initialize |
Adds event notification and listener management functionality to a given object. |
|
removeListener |
Removes an object from the list of objects that receive event notification messages. |
Methods inherited from class Object
|
|
|
|