Packageardisia.components.clocks
Classpublic class ClockAnalog
InheritanceClockAnalog Inheritance ClockBase Inheritance spark.components.Group

An analog clock. Not skinnable due to the complexity of separating layout and logic. Use the styles or override to customize.

View the technical documentation on the Ardisia Labs website for more information.

Default MXML PropertymxmlContent



Public Properties
 PropertyDefined By
  animated : Boolean
Set to true to animate the secondNeedle.
ClockAnalog
  animationDuration : Number
The duration in milliseconds for secondsNeedle animations.
ClockAnalog
  centerPin : Ellipse
The center pin.
ClockAnalog
  easer : IEaser
An IEaser to use with secondsNeedle animations.
ClockAnalog
  hoursNeedle : Rect
Needle to display the hours.
ClockAnalog
 InheritedisRunning : Boolean
[read-only] Returns true when the clock is running.
ClockBase
  minutesNeedle : Rect
Needle to display the minutes.
ClockAnalog
  secondsNeedle : Rect
Needle to display the seconds.
ClockAnalog
 InheritedupdateInterval : Number
The interval in milliseconds between clock updates.
ClockBase
 Inheriteduse24HourMode : Boolean
Set to true to display a clock using a 24 hour format.
ClockBase
 InheriteduseUTC : Boolean
Set to true to display UTC time, rather than local time.
ClockBase
 InheritedutcOffsetHours : Number
The hours to offset from UTC for display.
ClockBase
 InheritedutcOffsetMinutes : Number
The minutes to offset from UTC for display.
ClockBase
Public Methods
 MethodDefined By
  
dispose():void
[override] Call to remove the component from the display list and remove any event listeners.
ClockAnalog
 Inherited
start():void
Start the clock.
ClockBase
 Inherited
stop():void
Stop the clock.
ClockBase
  
update():void
[override] Call to update the clock to reflect the current time.
ClockAnalog
Protected Methods
 MethodDefined By
  
Calculate the angles at which to display the needles.
ClockAnalog
  
getEllipseRadius(w:Number, h:Number, theta:Number):Number
Returns the radius of the ellipse from the center to the given point on the ellipse perimeter at a given angle.
ClockAnalog
  
Initialize the labels.
ClockAnalog
 Inherited
timerHandler(event:TimerEvent):void
Handles events from the timer.
ClockBase
Events
 Event Summary Defined By
 InheritedDispatched when the clock starts running.ClockBase
 InheritedDispatched when the clock stops running.ClockBase
Styles
 Style Description Defined By
  
centerPinColor
Type: uint Format: Color CSS Inheritance: no
The color of the center pin. The default value is #AA0000.
ClockAnalog
  
displayLabels
Type: Boolean CSS Inheritance: no
True to display labels along the hour ticks. The default value is true.
ClockAnalog
  
hoursNeedleColor
Type: uint Format: Color CSS Inheritance: no
The color of the hours needle. The default value is #666666.
ClockAnalog
  
labelInset
Type: Number CSS Inheritance: no
The inset from the perimeter of the ellipse to the labels. The default value is 13.
ClockAnalog
  
labelRotation
Type: String CSS Inheritance: no
The type of rotation to apply to the labels. The default value is "none".
ClockAnalog
  
majorTickHeight
Type: Number CSS Inheritance: no
The height of the major ticks. The default value is 8.
ClockAnalog
  
majorTickWidth
Type: Number CSS Inheritance: no
The width of the major ticks. The default value is 6.
ClockAnalog
  
minorTickCount
Type: Number CSS Inheritance: no
The number of minor ticks between major ticks. The default value is 4.
ClockAnalog
  
minorTickHeight
Type: Number CSS Inheritance: no
The height of the minor ticks. The default value is 4.
ClockAnalog
  
minorTickWidth
Type: Number CSS Inheritance: no
The width of the minor ticks. The default value is 2.
ClockAnalog
  
minutesNeedleColor
Type: uint Format: Color CSS Inheritance: no
The color of the minutes needle. The default value is #898989.
ClockAnalog
  
secondsNeedleColor
Type: uint Format: Color CSS Inheritance: no
The color of the seconds needle. The default value is #ABABAB.
ClockAnalog
  
tickColor
Type: uint Format: Color CSS Inheritance: no
The color of the ticks. The default value is 0x333333.
ClockAnalog
  
tickInset
Type: Number CSS Inheritance: no
The inset from the perimeter of the ellipse to the ticks. The default value is 0.
ClockAnalog
  
useCircle
Type: Boolean CSS Inheritance: no
If true, the clock will render as a circle, using the smaller of the height/width as the radius. Will center itself inside the container. The default value is true.
ClockAnalog
Property Detail
animatedproperty
animated:Boolean

Set to true to animate the secondNeedle.

The default value is true.


Implementation
    public function get animated():Boolean
    public function set animated(value:Boolean):void
animationDurationproperty 
animationDuration:Number

The duration in milliseconds for secondsNeedle animations. Only relevant if the "animate" property is true.

If greater than the "updateInterval" will be adjusted down to the "updateInterval".

The default value is 1000.


Implementation
    public function get animationDuration():Number
    public function set animationDuration(value:Number):void
centerPinproperty 
public var centerPin:Ellipse

The center pin.

The default value is Ellipse.

easerproperty 
easer:IEaser

An IEaser to use with secondsNeedle animations. Only relevant if the "animate" property is true.

Defaults to a Elastic easer.

The default value is spark.effects.easing.Elastic.


Implementation
    public function get easer():IEaser
    public function set easer(value:IEaser):void
hoursNeedleproperty 
public var hoursNeedle:Rect

Needle to display the hours.

The default value is Rect.

minutesNeedleproperty 
public var minutesNeedle:Rect

Needle to display the minutes.

The default value is Rect.

secondsNeedleproperty 
public var secondsNeedle:Rect

Needle to display the seconds.

The default value is Rect.

Method Detail
calcNeedleAngles()method
protected function calcNeedleAngles():void

Calculate the angles at which to display the needles.

dispose()method 
override public function dispose():void

Call to remove the component from the display list and remove any event listeners.

getEllipseRadius()method 
protected function getEllipseRadius(w:Number, h:Number, theta:Number):Number

Returns the radius of the ellipse from the center to the given point on the ellipse perimeter at a given angle.

Derived from the ellipse equation - see http://en.wikipedia.org/wiki/Ellipse

Parameters

w:Number — the width of the ellipse
 
h:Number — the height of the ellipse
 
theta:Number — the angle at which the radius is to be computed

Returns
Number — the radius in pixels
setupLabelInstances()method 
protected function setupLabelInstances():void

Initialize the labels.

update()method 
override public function update():void

Call to update the clock to reflect the current time.