Class Index | File Index

Classes


Class Ticker

Provides a centralized tick or heartbeat broadcast at a set interval. Listeners can subscribe to the tick event to be notified when a set time interval has elapsed. Note that the interval that the tick event is called is a target interval, and may be broadcast at a slower interval during times of high CPU load.
Defined in: Ticker.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Ticker()
The Ticker class uses a static interface (ex.
Method Summary
Method Attributes Method Name and Description
<static>  
Ticker.addListener(o, pauseable)
Adds a listener for the tick event.
<static>  
Ticker.getFPS()
Returns the target frame rate in frames per second (FPS).
<static>  
Ticker.getInterval()
Returns the current target time between ticks, as set with setInterval.
<static>  
Ticker.getMeasuredFPS(ticks)
Returns the actual frames / ticks per second.
<static>  
Ticker.getPaused()
Returns a boolean indicating whether Ticker is currently paused, as set with setPaused.
<static>  
Ticker.getTicks(pauseable)
Returns the number of ticks that have elapsed while Ticker was active.
<static>  
Ticker.getTime(pauseable)
Returns the number of milliseconds that have elapsed since Ticker was loaded.
<static>  
Removes all listeners.
<static>  
Ticker.removeListener(o)
Removes the specified listener.
<static>  
Ticker.setFPS(value)
Sets the target frame rate in frames per second (FPS).
<static>  
Ticker.setInterval(interval)
Sets the target time (in milliseconds) between ticks.
<static>  
Ticker.setPaused(value)
While Ticker is paused, pausable listeners are not ticked.
Class Detail
Ticker()
The Ticker class uses a static interface (ex. Ticker.getPaused()) and should not be instantiated.
Method Detail
<static> Ticker.addListener(o, pauseable)
Adds a listener for the tick event. The listener object must expose a .tick() method, which will be called once each tick / interval. The interval is specified via the .setInterval(ms) method. The exposed tick method is passed a single parameter, which include the elapsed time between the previous tick and the current one.
Parameters:
o
The object to add as a listener.
pauseable
If false, the listener will continue to have tick called even when Ticker is paused via Ticker.pause(). Default is true.

<static> Ticker.getFPS()
Returns the target frame rate in frames per second (FPS). For example, with an interval of 40, getFPS() will return 25 (1000ms per second divided by 40 ms per tick = 25fps).

<static> Ticker.getInterval()
Returns the current target time between ticks, as set with setInterval.

<static> Ticker.getMeasuredFPS(ticks)
Returns the actual frames / ticks per second.
Parameters:
ticks
Optional. The number of previous ticks over which to measure the actual frames / ticks per second.

<static> Ticker.getPaused()
Returns a boolean indicating whether Ticker is currently paused, as set with setPaused.

<static> Ticker.getTicks(pauseable)
Returns the number of ticks that have elapsed while Ticker was active.
Parameters:
pauseable
Indicates whether to return the elapsed ticks for pauseable, or unpauseable listeners.

<static> Ticker.getTime(pauseable)
Returns the number of milliseconds that have elapsed since Ticker was loaded. For example, you could use this in a time synchronized animation to determine the exact amount of time that has elapsed.
Parameters:
pauseable
Indicates whether to return the elapsed time for pauseable, or unpauseable listeners. If true, time that elapsed while Ticker was paused is not included.

<static> Ticker.removeAllListeners()
Removes all listeners.

<static> Ticker.removeListener(o)
Removes the specified listener.
Parameters:
o
The object to remove from listening from the tick event.

<static> Ticker.setFPS(value)
Sets the target frame rate in frames per second (FPS). For example, with an interval of 40, getFPS() will return 25 (1000ms per second divided by 40 ms per tick = 25fps).
Parameters:
value
Target number of ticks broadcast per second.

<static> Ticker.setInterval(interval)
Sets the target time (in milliseconds) between ticks. Default is 50 (20 FPS). Note actual time between ticks may be more than requested depending on CPU load.
Parameters:
interval
Time in milliseconds between ticks.

<static> Ticker.setPaused(value)
While Ticker is paused, pausable listeners are not ticked. See addListener for more information.
Parameters:
value
Indicates whether to pause (true) or unpause (false) Ticker.

Documentation generated by JsDoc Toolkit 2.3.2 on Sun Feb 13 2011 22:46:01 GMT-0700 (MST)