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
A TickBeacon object is an object which provides
time 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.

See also:

Summary


Instance methods
  • 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

public function addTickListener (
listener:TickListener) : void

Adds the passed-in listener as listener for
this TickBeacon. Concret implementations should
start 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.

Parameters:
listener:
tick listener to be added

isPlaying

public function isPlaying (
) : Boolean

Returns true if this beacon object is currently
running.
Returns:
  • true if this beacon object is currently
    running

removeTickListener

public function removeTickListener (
listener:TickListener) : void

Removes the passed-in listener from listening for this beacon's
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.
Parameters:
listener:
tick listener to be removed

start

public function start (
) : void

Starts this beacon if it wasn't already nunning.

stop

public function stop (
) : void

Stops this beacon if it wasn't already stopped.