AbstractImpulse
| Kind of class: | class |
|---|---|
| Inherits from: | BasicClass |
| Known subclasses: | |
| Version: | 1.0 |
| Author: | Martin Heidegger |
| Classpath: | org.as2lib.env.event.impulse.AbstractImpulse |
| File last modified: | Monday, 04 July 2005, 18:18:46 |
AbstractImpulse is a helper class that contains shared API to be usedby different Impulse Implementations.
Summary
Constructor
Instance methods
- connectExecutable
- addAllListeners
- addListener
- addImpulseListener
- removeListener
- disconnectExecutable
- removeImpulseListener
- removeAllListeners
- removeAllImpulseListeners
- disconnectAllExecutables
- getAllListeners
- getAllConnectedExecutables
- getAllImpulseListeners
- addAllImpulseListeners
- connectAllExecutables
- hasListener
- hasImpulseListener
- isExecutableConnected
Instance methods inherited from BasicClass
Constructor
AbstractImpulse
function AbstractImpulse (
)
Constructs a new impulse.
Instance methods
addAllImpulseListeners
function addAllImpulseListeners (
listeners:Array) : Void
Adds a list of ImpulseListeners as listener to the events.
Parameters:
listeners:
List of all listeners to add.
Throws:
org.as2lib.env.except.IllegalArgumentException if one listener didn't match to any listener type.
See also:
addAllListeners
function addAllListeners (
listeners:Array) : Void
Adds a list of listeners to listen to the impulse events.
Parameters:
listeners:
List of listeners to be added.
Throws:
org.as2lib.env.except.IllegalArgumentException if a listener could not be added.
addImpulseListener
function addImpulseListener (
listener:ImpulseListener) : Void
Methode to add a ImpulseListener as listener to the Impulse.
Some parts of the code get better readable if you use a complete
clear name like "onImpulse" to define your code. With
.addImpulseListener you can add a listener that specially
listens only to this naming of the same event that will be executed as
"execute".
Example:
Listener:
import org.as2lib.env.event.impulse.ImpulseListener; import org.as2lib.env.event.impulse.Impulse; class TraceTimeImpulseListener implements ImpulseListener { public function onImpulse(impulse:Impulse):Void { trace("Impulse executed at "+getTimer()); } }
Usage:
import org.as2lib.env.event.impulse.FrameImpulse; var impulse:FrameImpulse = FrameImpulse.getInstance(); impulse.addImpulseListener(new TraceTimeImpulseListener());
Parameters:
listener:
Listener to be added.
addListener
function addListener (
listener) : Void
Method to add any supported listener to the FrameImpulse.
Adds a listener to the Impulse. The listener will be informed on
each frame change.
Note: If a certain listener implements more than one supported event it
will listen to all of them at one execution (execute, onFrameImpulse,
onImpulse).
Parameters:
listener:
to be added.
Throws:
org.as2lib.env.except.IllegalArgumentException if the listener doesn't match any type.
connectAllExecutables
function connectAllExecutables (
executables:Array) : Void
Connects a list of Executabless to the impulse.
Parameters:
listeners:
List of all listeners to add.
Throws:
org.as2lib.env.except.IllegalArgumentException if one listener didn't match to any listener type.
See also:
connectExecutable
function connectExecutable (
exe:Executable) : Void
Connects a executable as listener to the frame execution.
Parameters:
exe:
Executable to be added as listener
disconnectAllExecutables
function disconnectAllExecutables (
Void) : Void
Disconnects all connected org.as2lib.app.exec.Executables from the impulse.
disconnectExecutable
function disconnectExecutable (
exe:Executable) : Void
Disconnects a org.as2lib.app.exec.Executable from listening to the impulse.
Parameters:
exe:
org.as2lib.app.exec.Executable to disconnect.
getAllConnectedExecutables
function getAllConnectedExecutables (
Void) : Array
Getter for the list of all connected org.as2lib.app.exec.Executables.
Returns:
List that contains all connected org.as2lib.app.exec.Executables.
getAllImpulseListeners
function getAllImpulseListeners (
Void) : Array
Getter for the list of all added ImpulseListeners.
Returns:
List that contains all added ImpulseListeners.
getAllListeners
function getAllListeners (
Void) : Array
Getter for the list of all added listeners.
This method returns a list of all listeners added with eihter
connectExecutable, addListener or
addImpulseListener
Returns:
List that contains all added listeners.
hasImpulseListener
function hasImpulseListener (
listener:ImpulseListener) : Boolean
Validates if a certain ImpulseListener is currently added to the
impulse.
impulse.
Parameters:
listener:
ImpulseListener to be validated.
Returns:
true if the certain executable is connected.hasListener
function hasListener (
listener) : Boolean
Validates if a certain listener of any type is currently added to the
impulse.
impulse.
Parameters:
listener:
Listener to be validated.
Returns:
true if the certain executable is connected.See also:
isExecutableConnected
function isExecutableConnected (
exe:Executable) : Boolean
Validates if a certain org.as2lib.app.exec.Executable is currently connected to the
impulse.
impulse.
Parameters:
exe:
org.as2lib.app.exec.Executable to be validated.
Returns:
true if the certain executable is connected.removeAllImpulseListeners
function removeAllImpulseListeners (
Void) : Void
Removes all added ImpulseListeners from listening to the impulse.
removeAllListeners
function removeAllListeners (
Void) : Void
Removes all added Listeners from listening to the impulse.
removeImpulseListener
function removeImpulseListener (
listener:ImpulseListener) : Void
Removes a ImpulseListener from listening to the impulse.
Parameters:
listener:
ImpulseListener to remove from listening.
removeListener
function removeListener (
listener) : Void
Removes a listener of any type that might be added.
Parameters:
listener:
Listener to be removed.
Throws:
org.as2lib.env.except.IllegalArgumentException if you pass a listener that is of a
illegal type.
illegal type.