Packagecom.bit101.components
Classpublic class Knob
InheritanceKnob Inheritance Component Inheritance flash.display.Sprite



Public Properties
 PropertyDefined By
 Inheritedenabled : Boolean
Sets/gets whether this component is enabled or not.
Component
 Inheritedheight : Number
[override] Sets/gets the height of the component.
Component
  label : String
Gets / sets the text shown in this component's label.
Knob
  labelPrecision : int
Gets / sets the number of decimals to format the value label.
Knob
  maximum : Number
Gets / sets the maximum value of this knob.
Knob
  minimum : Number
Gets / sets the minimum value of this knob.
Knob
  mode : String
Knob
  mouseRange : Number
Sets / gets the number of pixels the mouse needs to move to make the value of the knob go from min to max.
Knob
  radius : Number
Knob
  showValue : Boolean
Gets / sets whether or not to show the value label.
Knob
 Inheritedtag : int
Sets/gets in integer that can identify the component.
Component
  value : Number
Sets / gets the current value of this knob.
Knob
 Inheritedwidth : Number
[override] Sets/gets the width of the component.
Component
 Inheritedx : Number
[override] [write-only] Overrides the setter for x to always place the component on a whole pixel.
Component
 Inheritedy : Number
[override] [write-only] Overrides the setter for y to always place the component on a whole pixel.
Component
Protected Properties
 PropertyDefined By
 Inherited_enabled : Boolean = true
Component
 Inherited_height : Number = 0
Component
  _knob : Sprite
Knob
  _label : Label
Knob
  _labelText : String
Knob
  _max : Number = 100
Knob
  _min : Number = 0
Knob
  _mode : String = vertical
Knob
  _mouseRange : Number = 100
Knob
  _precision : int = 1
Knob
  _radius : Number = 20
Knob
 InheritedRonda : Class
Component
  _startX : Number
Knob
  _startY : Number
Knob
 Inherited_tag : int = -1
Component
  _value : Number = 0
Knob
  _valueLabel : Label
Knob
 Inherited_width : Number = 0
Component
Public Methods
 MethodDefined By
  
Knob(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0, label:String, defaultHandler:Function = null)
Constructor
Knob
  
draw():void
[override] Draws the visual ui of the component.
Knob
 Inherited
initStage(stage:Stage):void
[static] Utility method to set up usual stage align and scaling.
Component
 Inherited
move(xpos:Number, ypos:Number):void
Moves the component to the specified position.
Component
 Inherited
setSize(w:Number, h:Number):void
Sets the size of the component.
Component
Protected Methods
 MethodDefined By
  
[override] Creates the children for this component
Knob
  
Adjusts value to be within minimum and maximum.
Knob
  
drawKnob():void
Draw the knob at the specified radius.
Knob
  
Formats the value of the knob to a string based on the current level of precision.
Knob
 Inherited
getShadow(dist:Number, knockout:Boolean = false):DropShadowFilter
DropShadowFilter factory method, used in many of the components.
Component
  
init():void
[override] Initializes the component.
Knob
 Inherited
invalidate():void
Marks the component to be redrawn on the next frame.
Component
 Inherited
onInvalidate(event:Event):void
Called one frame after invalidate is called.
Component
  
onMouseDown(event:MouseEvent):void
Internal handler for when user clicks on the knob.
Knob
  
onMouseMove(event:MouseEvent):void
Internal handler for mouse move event.
Knob
  
onMouseUp(event:MouseEvent):void
Internal handler for mouse up event.
Knob
  
updateKnob():void
Updates the rotation of the knob based on the value, then formats the value label.
Knob
Public Constants
 ConstantDefined By
 InheritedDRAW : String = draw
[static]
Component
  HORIZONTAL : String = horizontal
[static]
Knob
  ROTATE : String = rotate
[static]
Knob
  VERTICAL : String = vertical
[static]
Knob
Property Detail
_knobproperty
protected var _knob:Sprite

_labelproperty 
protected var _label:Label

_labelTextproperty 
protected var _labelText:String

_maxproperty 
protected var _max:Number = 100

_minproperty 
protected var _min:Number = 0

_modeproperty 
protected var _mode:String = vertical

_mouseRangeproperty 
protected var _mouseRange:Number = 100

_precisionproperty 
protected var _precision:int = 1

_radiusproperty 
protected var _radius:Number = 20

_startXproperty 
protected var _startX:Number

_startYproperty 
protected var _startY:Number

_valueproperty 
protected var _value:Number = 0

_valueLabelproperty 
protected var _valueLabel:Label

labelproperty 
label:String

Gets / sets the text shown in this component's label.


Implementation
    public function get label():String
    public function set label(value:String):void
labelPrecisionproperty 
labelPrecision:int

Gets / sets the number of decimals to format the value label.


Implementation
    public function get labelPrecision():int
    public function set labelPrecision(value:int):void
maximumproperty 
maximum:Number

Gets / sets the maximum value of this knob.


Implementation
    public function get maximum():Number
    public function set maximum(value:Number):void
minimumproperty 
minimum:Number

Gets / sets the minimum value of this knob.


Implementation
    public function get minimum():Number
    public function set minimum(value:Number):void
modeproperty 
mode:String


Implementation
    public function get mode():String
    public function set mode(value:String):void
mouseRangeproperty 
mouseRange:Number

Sets / gets the number of pixels the mouse needs to move to make the value of the knob go from min to max.


Implementation
    public function get mouseRange():Number
    public function set mouseRange(value:Number):void
radiusproperty 
radius:Number


Implementation
    public function get radius():Number
    public function set radius(value:Number):void
showValueproperty 
showValue:Boolean

Gets / sets whether or not to show the value label.


Implementation
    public function get showValue():Boolean
    public function set showValue(value:Boolean):void
valueproperty 
value:Number

Sets / gets the current value of this knob.


Implementation
    public function get value():Number
    public function set value(value:Number):void
Constructor Detail
Knob()Constructor
public function Knob(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0, label:String, defaultHandler:Function = null)

Constructor

Parameters
parent:DisplayObjectContainer (default = null) — The parent DisplayObjectContainer on which to add this Knob.
 
xpos:Number (default = 0) — The x position to place this component.
 
ypos:Number (default = 0) — The y position to place this component.
 
label:String — String containing the label for this component.
 
defaultHandler:Function (default = null) — The event handling function to handle the default event for this component (change in this case).
Method Detail
addChildren()method
override protected function addChildren():void

Creates the children for this component

correctValue()method 
protected function correctValue():void

Adjusts value to be within minimum and maximum.

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

Draws the visual ui of the component.

drawKnob()method 
protected function drawKnob():void

Draw the knob at the specified radius.

formatValueLabel()method 
protected function formatValueLabel():void

Formats the value of the knob to a string based on the current level of precision.

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

Initializes the component.

onMouseDown()method 
protected function onMouseDown(event:MouseEvent):void

Internal handler for when user clicks on the knob. Starts tracking up/down motion of the mouse.

Parameters

event:MouseEvent

onMouseMove()method 
protected function onMouseMove(event:MouseEvent):void

Internal handler for mouse move event. Updates value based on how far mouse has moved up or down.

Parameters

event:MouseEvent

onMouseUp()method 
protected function onMouseUp(event:MouseEvent):void

Internal handler for mouse up event. Stops mouse tracking.

Parameters

event:MouseEvent

updateKnob()method 
protected function updateKnob():void

Updates the rotation of the knob based on the value, then formats the value label.

Constant Detail
HORIZONTALConstant
public static const HORIZONTAL:String = horizontal

ROTATEConstant 
public static const ROTATE:String = rotate

VERTICALConstant 
public static const VERTICAL:String = vertical