Access keys

Stopwatch

Kind of class: class
Inherits from: CoreObject
Implements:
Version: 12/14/06
Author: Aaron Clinger
Classpath: org.casaframework.time.Stopwatch
File last modified: Monday, 08 January 2007, 09:57:51
Simple stopwatch class that records elapsed time in milliseconds.
Example:
var stopwatch:Stopwatch = new Stopwatch();

this.start_mc.onPress = function():Void {
    this._parent.stopwatch.start();
    trace("Stopwatch started.");
}

this.stop_mc.onPress = function():Void {
    trace("Stopwatch stopped. Time elapsed: " + this._parent.stopwatch.stop());
}

this.resume_mc.onPress = function():Void {
    this._parent.stopwatch.resume();
    trace("Stopwatch continued.");
}

Summary

Constructor
Instance properties
Instance properties inherited from CoreObject
Instance methods
Instance methods inherited from CoreObject

Constructor

Stopwatch

function Stopwatch (
)

Instance methods

destroy

function destroy (
) : Void
Removes internal variables, intervals, enter frames, internal MovieClips and event observers to allow the object to be garbage collected.

Always call destroy() before deleting/removing object instance.
#

getTime

function getTime (
) : Number
Gets the time elapsed since start or until stop was called.
Returns:
Returns the elapsed time in milliseconds.
Usage note:
Can be called before or after calling stop.

resume

function resume (
) : Void
Resumes stopwatch from stop.

start

function start (
) : Void
Starts stopwatch and resets previous elapsed time.

stop

function stop (
) : Void
Stops stopwatch.