Packagecom.eqsim.components
Classpublic class Stopwatch
InheritanceStopwatch Inheritance fl.core.UIComponent

This class implements a stopwatch that can be started, paused, and reset. It does not subclass timer, it just uses a timer object. The resolution property is the resolution of the stopwatch (minimum value for checking if time has elapsed). When you need to optimize precision, you should adjust resolution to a resolution that is at most half of the shortest interval you need to measure.

The class has one event, by default called "onPulse" (but this can be changed in the component parameter panel, or programmatically by setting evtPulse).



Public Properties
 PropertyDefined By
  active : Boolean
Set this value to start or stop the timing interval.
Stopwatch
  evtPulse : String = onPulse
This property holds the string name of the event.
Stopwatch
  pulseInterval : int
This property indicates the interval at which to generate pulse events when the stopwatch is active.
Stopwatch
  _resolution : int = 100
Stopwatch
  resolution : int
This property holds the resolution of the timer.
Stopwatch
Protected Properties
 PropertyDefined By
  goQuietly : Boolean
Stopwatch
  _lastTime : int
Stopwatch
  _oldVal : int
Stopwatch
  origHeight : Number
Stopwatch
  origWidth : Number
Stopwatch
  previewBox : MovieClip
Stopwatch
  st : SimpleTimer
Stopwatch
  StopwatchPreviewClip : Class
Stopwatch
  _val : int
Stopwatch
Public Methods
 MethodDefined By
  
Stopwatch
  
destroy():void
Remove this component's associated listeners and memory.
Stopwatch
  
getTime():Number
Retrieve the current time of the stopwatch.
Stopwatch
  
pause():void
Pause the stopwatch.
Stopwatch
  
reset():void
Reset the stopwatch.
Stopwatch
  
start():void
Activate the stopwatch.
Stopwatch
Protected Methods
 MethodDefined By
  
configUI():void
[override] configUI Get the display objects created in preparation of launch.
Stopwatch
  
draw():void
[override]
Stopwatch
  
Called when someone has changed a stopwatch parameter.
Stopwatch
  
This is called on timer interrupts.
Stopwatch
Events
 Event Summary Defined By
  Event generated at a user-controllable interval while the stopwatch is running.Stopwatch
Property Detail
_lastTimeproperty
protected var _lastTime:int

_oldValproperty 
protected var _oldVal:int

_resolutionproperty 
public var _resolution:int = 100

_valproperty 
protected var _val:int

activeproperty 
active:Boolean

Set this value to start or stop the timing interval. If changed while the timer is active, the timer resets and starts again.


Implementation
    public function get active():Boolean
    public function set active(value:Boolean):void
evtPulseproperty 
public var evtPulse:String = onPulse

This property holds the string name of the event.

goQuietlyproperty 
protected var goQuietly:Boolean

origHeightproperty 
protected var origHeight:Number

origWidthproperty 
protected var origWidth:Number

previewBoxproperty 
protected var previewBox:MovieClip

pulseIntervalproperty 
pulseInterval:int

This property indicates the interval at which to generate pulse events when the stopwatch is active. Use 0 to mean don't generate pulses at all.


Implementation
    public function get pulseInterval():int
    public function set pulseInterval(value:int):void
resolutionproperty 
resolution:int

This property holds the resolution of the timer. This must be set to the pulse interval at the maximum. It determines how often we check to see that the stopwatch has advanced.


Implementation
    public function get resolution():int
    public function set resolution(value:int):void
stproperty 
protected var st:SimpleTimer

StopwatchPreviewClipproperty 
protected var StopwatchPreviewClip:Class

Constructor Detail
Stopwatch()Constructor
public function Stopwatch()

Method Detail
configUI()method
override protected function configUI():void

configUI Get the display objects created in preparation of launch. Note that we get called before our constructor, and before we are notified that we are on the stage!

destroy()method 
public function destroy():void

Remove this component's associated listeners and memory.

draw()method 
override protected function draw():void

getTime()method 
public function getTime():Number

Retrieve the current time of the stopwatch.

Returns
Number
pause()method 
public function pause():void

Pause the stopwatch.

reset()method 
public function reset():void

Reset the stopwatch.

resetStopwatchParameters()method 
protected function resetStopwatchParameters():void

Called when someone has changed a stopwatch parameter. If the stopwatch is running, we pause it, reset the values, then restart. If the stopwatch is not active, we don't need to do anything (parameters are set outside us).

start()method 
public function start():void

Activate the stopwatch.

timerElapsed()method 
protected function timerElapsed(te:EventWithData):void

This is called on timer interrupts. Decide if we should issue a pulse.

Parameters

te:EventWithData

Event Detail
onPulse Event

Event generated at a user-controllable interval while the stopwatch is running.