Package | com.eqsim.components |
Class | public class Potentiometer |
Inheritance | Potentiometer ![]() ![]() |
This class implements a simple potentiometer, which is virtually identical in functionality to
the jog knob (Jog). Developers can set the increment, number of values
in one cycle, integer vs. discrete, minimum and maximum values, and whether the jog is adjusted by clicking and dragging,
or merely moving in a circular motion (dragOrOver
).
Developers can change the appearance by modifying:
defPotBkgnd
- backgrounddefPotIndicator
- indicator clipYou can change the indicator (the part of the jog that rotates) by changing the
indicatorClassName
parameter, to replace the default indicator graphic with a MovieClip/Sprite from
the Library specified by class name. The movie clip must have its center at
the center of rotation, so if the developer simply wants to change the indicator (notch), then the
indicator should be placed in the topmost (pointing up) position at the edge of the background. Even if you turn off the background graphic, that clip
is used to determine the hit area of the knob, as well as the indicator graphic itself.
The class has one event, by default called "onValChg" (but this can
be changed in the property inspector, or by changing the evtChg
property), and
the value is the increment that
the jog was moved. The drawTicks
property, if true, tells the component
to draw numTicks
ticks.
The potentiometer value can be set using the val
property or through the setVal()
method.
If the enabled
property is set to false
, the component will generate an onDisabled
event with no data.
Property | Defined By | ||
---|---|---|---|
![]() | backgroundClassName : String
Class name of the background Sprite
| Jog | |
![]() | clickSoundClass : String
Class name of the audio click. | Jog | |
![]() | discreteSteps : Boolean
Whether jog moves in discrete steps (integers) or continuous. | Jog | |
![]() | evtChg : String = onValChg
Let user change the event names, if desired. | Jog | |
![]() | evtDisabled : String = onDisabled
Let user change the event names, if desired. | Jog | |
![]() | indicatorClassName : String
Class name of the indicator Sprite
| Jog | |
maxVal : Number
Set the maximum value for this knob. | Potentiometer | ||
minVal : Number
Set the minimum value for this knob. | Potentiometer | ||
![]() | numTicks : int
Number of tick marks to distribute around knob. | Jog | |
![]() | showBkgnd : Boolean
Show or hide the background. | Jog | |
![]() | showHand : Boolean
Show or hide the hand cursor
| Jog | |
![]() | showTicks : Boolean
Whether or not to show the tick marks. | Jog | |
![]() | snap2Int : Boolean = false
Snap the indicator to the closest integer position when user released mouse
| Jog | |
![]() | tickLineColor : int
Tick line color (if showTicks is true). | Jog | |
![]() | tickLineThickness : int
Tick line thickness (if showTicks is true). | Jog | |
![]() | _turnByDragging : Boolean = true | Jog | |
![]() | turnByDragging : Boolean
Whether interaction is by click-and-drag (true) or roll-over (false). | Jog | |
![]() | units : int
Units in one revolution. | Jog | |
![]() | useSound : Boolean
Whether or not to play the sound on a value change (default is false, do not play sound). | Jog | |
![]() | val : Number
Starting value (from 0 to units (number of units in 1 revolution). | Jog |
Method | Defined By | ||
---|---|---|---|
Potentiometer | |||
![]() | destroy():void
Removes internal listeners and memory associated with the component. | Jog | |
![]() | execEvent(evName:String, evVal:Number, q:Boolean):void
Given an event string and value that matches what this component would generate, perform the action. | Jog | |
![]() | incrVal(incr:Number, q:Boolean):void
Increments the jog by incr units (positive or negative). | Jog |
Method | Defined By | ||
---|---|---|---|
![]() | changeBackground(n:String):void | Jog | |
![]() | changeIndicator(n:String):void | Jog | |
configUI():void [override]
configUI
Get the display objects created in preparation of launch. | Potentiometer | ||
![]() | draw():void [override]
| Jog | |
![]() | drawTicks():void
Routine draws the tick marks, when developer requests them drawn. | Jog | |
genEvent(v:Number):void [override]
We override the potentiometer's method for genEvent so we send the value property, not the incremental difference. | Potentiometer | ||
![]() | jogEngage(me:MouseEvent):void
Called when the operator is about to move the jog. | Jog | |
![]() | jogRelease(me:MouseEvent):void
Called when the operator releases the jog from turning. | Jog | |
![]() | playClick():void | Jog | |
![]() | rotZ(vObj:Point, ang:Number):void
Rotates a given Point (vObj.x, vObj.y) around the Z-axis by ang degrees and puts the new point back in the x and y properties. | Jog | |
![]() | setAVal(ang:Number, realAng:Number):void
Translate the current angle into an increment from the last knob position,
then notify listeners with the new value. | Jog | |
![]() | setClickSound(s:String):void | Jog | |
![]() | setupMouseEvents():void | Jog | |
setVal(v:Number, q:Boolean = false):void [override]
Sets the position of the potentiometer. | Potentiometer | ||
![]() | trackMouse(me:MouseEvent):void
The routine that tracks mouse movements and converts them to jog movements. | Jog |
Event | Summary | Defined By | ||
---|---|---|---|---|
Potentiometer | ||||
Event generated when jog knob value has changed. | Potentiometer |
maxVal | property |
maxVal:Number
Set the maximum value for this knob.
public function get maxVal():Number
public function set maxVal(value:Number):void
minVal | property |
minVal:Number
Set the minimum value for this knob.
public function get minVal():Number
public function set minVal(value:Number):void
Potentiometer | () | Constructor |
public function Potentiometer()
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!
genEvent | () | method |
override protected function genEvent(v:Number):void
We override the potentiometer's method for genEvent so we send the value property, not the incremental difference.
Parameters
v:Number — value of the knob
|
setVal | () | method |
override protected function setVal(v:Number, q:Boolean = false):void
Sets the position of the potentiometer.
Parameters
v:Number — Numeric value (between minVal and maxVal )
| |
q:Boolean (default = false ) — Boolean flag indicating whether to set the value quietly (no event notification) or with notification (false [default]).
|
onDisabled | Event |
onValChg | Event |
Event generated when jog knob value has changed.