Package com.bit101.components
Class public class Knob
Inheritance Knob InheritanceComponent Inheritance flash.display.Sprite



Public Properties
  Property Defined By
  Inherited enabled : Boolean
Sets/gets whether this component is enabled or not.
Component
  Inherited height : 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
  Inherited tag : int
Sets/gets in integer that can identify the component.
Component
    value : Number
Sets / gets the current value of this knob.
Knob
  Inherited width : Number
[override] Sets/gets the width of the component.
Component
  Inherited x : Number
[override] [write-only] Overrides the setter for x to always place the component on a whole pixel.
Component
  Inherited y : Number
[override] [write-only] Overrides the setter for y to always place the component on a whole pixel.
Component
Protected Properties
  Property Defined 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
  Inherited Ronda : 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
  Method Defined 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
  Method Defined By
   
addChildren():void
[override] Creates the children for this component
Knob
   
correctValue():void
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
  Constant Defined By
  Inherited DRAW : String = draw
[static]
Component
    HORIZONTAL : String = horizontal
[static]
Knob
    ROTATE : String = rotate
[static]
Knob
    VERTICAL : String = vertical
[static]
Knob
Property Detail
_knob property
protected var _knob:Sprite

_label property  
protected var _label:Label

_labelText property  
protected var _labelText:String

_max property  
protected var _max:Number = 100

_min property  
protected var _min:Number = 0

_mode property  
protected var _mode:String = vertical

_mouseRange property  
protected var _mouseRange:Number = 100

_precision property  
protected var _precision:int = 1

_radius property  
protected var _radius:Number = 20

_startX property  
protected var _startX:Number

_startY property  
protected var _startY:Number

_value property  
protected var _value:Number = 0

_valueLabel property  
protected var _valueLabel:Label

label property  
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
labelPrecision property  
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
maximum property  
maximum:Number

Gets / sets the maximum value of this knob.


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

Gets / sets the minimum value of this knob.


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


Implementation
    public function get mode():String
    public function set mode(value:String):void
mouseRange property  
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
radius property  
radius:Number


Implementation
    public function get radius():Number
    public function set radius(value:Number):void
showValue property  
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
value property  
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
HORIZONTAL Constant
public static const HORIZONTAL:String = horizontal

ROTATE Constant  
public static const ROTATE:String = rotate

VERTICAL Constant  
public static const VERTICAL:String = vertical