| Package | com.bit101.components |
| Class | public class Knob |
| Inheritance | Knob Component flash.display.Sprite |
| Property | Defined By | ||
|---|---|---|---|
![]() |
enabled : Boolean
Sets/gets whether this component is enabled or not.
|
Component | |
![]() |
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 | ||
![]() |
tag : int
Sets/gets in integer that can identify the component.
|
Component | |
|
value : Number
Sets / gets the current value of this knob.
|
Knob | ||
![]() |
width : Number [override]
Sets/gets the width of the component.
|
Component | |
![]() |
x : Number [override] [write-only]
Overrides the setter for x to always place the component on a whole pixel.
|
Component | |
![]() |
y : Number [override] [write-only]
Overrides the setter for y to always place the component on a whole pixel.
|
Component | |
| Property | Defined By | ||
|---|---|---|---|
![]() |
_enabled : Boolean = true | Component | |
![]() |
_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 | ||
![]() |
Ronda : Class | Component | |
| _startX : Number | Knob | ||
| _startY : Number | Knob | ||
![]() |
_tag : int = -1 | Component | |
| _value : Number = 0 | Knob | ||
| _valueLabel : Label | Knob | ||
![]() |
_width : Number = 0 | Component | |
| 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 | ||
![]() |
initStage(stage:Stage):void
[static]
Utility method to set up usual stage align and scaling.
|
Component | |
![]() |
move(xpos:Number, ypos:Number):void
Moves the component to the specified position.
|
Component | |
![]() |
setSize(w:Number, h:Number):void
Sets the size of the component.
|
Component | |
| 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 | ||
|
formatValueLabel():void
Formats the value of the knob to a string based on the current level of precision.
|
Knob | ||
![]() |
getShadow(dist:Number, knockout:Boolean = false):DropShadowFilter
DropShadowFilter factory method, used in many of the components.
|
Component | |
|
init():void
[override]
Initializes the component.
|
Knob | ||
![]() |
invalidate():void
Marks the component to be redrawn on the next frame.
|
Component | |
![]() |
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 | ||
| Constant | Defined By | ||
|---|---|---|---|
![]() |
DRAW : String = draw [static]
|
Component | |
|
HORIZONTAL : String = horizontal [static]
|
Knob | ||
|
ROTATE : String = rotate [static]
|
Knob | ||
|
VERTICAL : String = vertical [static]
|
Knob | ||
| _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.
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.
public function get labelPrecision():int public function set labelPrecision(value:int):void| maximum | property |
maximum:Number
Gets / sets the maximum value of this knob.
public function get maximum():Number public function set maximum(value:Number):void| minimum | property |
minimum:Number
Gets / sets the minimum value of this knob.
public function get minimum():Number public function set minimum(value:Number):void| mode | property |
mode:String
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.
public function get mouseRange():Number public function set mouseRange(value:Number):void| radius | property |
radius:Number
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.
public function get showValue():Boolean public function set showValue(value:Boolean):void| value | property |
value:Number
Sets / gets the current value of this knob.
public function get value():Number public function set value(value:Number):void| 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).
|
| 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.
| HORIZONTAL | Constant |
public static const HORIZONTAL:String = horizontal
| ROTATE | Constant |
public static const ROTATE:String = rotate
| VERTICAL | Constant |
public static const VERTICAL:String = vertical