TickBeacon
| Kind of class: | public interface |
|---|---|
| Package: | com.bourre.transitions |
| Inherits from: | none |
| Implemented by: | |
| Author: | Francis Bourre, Cédric Néhémie |
| Classpath: | com.bourre.transitions.TickBeacon |
| File last modified: | Tuesday, 15 January 2008, 22:47:03 |
TickBeacon object is an object which providestime slicing in an application. Many objects such tweens or
timed commands plug themselves on a beacon and will be noticed
of time change.
The tick is the atomic unit of computation, it correspond to
a step of computation in an animation. Its an equivalent to
the frame unit, but, rather than using the frame as unit, which
is more suitable for timeline based animation, we choose to use
the tick, which is a more generic notion.
Each concret implemetation or instance of beacon could have a different
atomic time entity, with different scale. For example a beacon can work
with the flash player ENTER_FRAME event, with a framerate
set to 40, and in parrallel there could be two others
beacons, working with the setInterval function and with step
respectively set to 10ms and 100ms.
The main contract defined by this interface is that all time beacons
objects should register and unregister as many listeners as needed.
These listeners will be noticed of time change only if the beacon
is currently running (according to the isPlaying return).
Each listener must implements the TickListener interface.
Concret implementation of the TickBeacon interface should
take care of not registering twice an object, in order to prevent time
scale breaks.
Summary
- addTickListener (listener:TickListener) : void
- Adds the passed-in listener as listener for
- removeTickListener (listener:TickListener) : void
- Removes the passed-in listener from listening for this beacon's
- start : void
- Starts this beacon if it wasn't already nunning.
- stop : void
- Stops this beacon if it wasn't already stopped.
- isPlaying : Boolean
- Returns true if this beacon object is currently
Instance methods
addTickListener
listener as listener forthis
TickBeacon. Concret implementations shouldstart themselves when a first listener is added. That behavior
ensure that there's no running beacon which have no listeners
registered. It also guarantee that an object will immediatly
run when it add itself as listener.
Concret implementation should not register an object which was
already a listener of this beacon.
isPlaying
true if this beacon object is currentlyrunning.
-
trueif this beacon object is currently
running
removeTickListener
event. Concret implementations should stop themselves when the
last listener is removed. That behavior ensure that there's no
running beacon which have no listeners registered.