Package | com.eqsim.components |
Class | public class Jog |
Inheritance | Jog ![]() |
Subclasses | Potentiometer |
This class implements a simple jog. Developers can set the increment, number of positions in one cycle, integer vs. discrete, and whether the jog is adjusted by clicking and dragging, or merely moving in a circular motion.
Developers can change the appearance by modifying:
defJogBkgnd
- backgrounddefJogIndicator
- 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 position of the jog indicator can be set using the val
property (from 0 to units
[number of units in one revolution]).
If the enabled
property is set to false
, the component will generate an onDisabled
event with no data. That event
name can also be changed using the evtDisabled
property.
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 | ||
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 |
Property | Defined By | ||
---|---|---|---|
_backgroundClassName : String = defJogBackground | Jog | ||
backgroundClip : Sprite | Jog | ||
baseAng : Number | Jog | ||
_beginVal : Number | Jog | ||
_clickSoundClass : String = aClickSound | Jog | ||
_discreteSteps : Boolean = false | Jog | ||
holdAng : Number | Jog | ||
holdAngSet : Boolean | Jog | ||
_indicatorClassName : String = defJogIndicator | Jog | ||
indicatorClip : Sprite | Jog | ||
knobContainer : Sprite | Jog | ||
lastIntVal : Number | Jog | ||
_numTicks : int = 12 | Jog | ||
oldAng : Number | Jog | ||
_showBkgnd : Boolean = true | Jog | ||
_showHand : Boolean = true | Jog | ||
_showTicks : Boolean = false | Jog | ||
sndObj : Sound | Jog | ||
_tickLineColor : int = 0 | Jog | ||
_tickLineThickness : Number = 1 | Jog | ||
tickSprite : Sprite | Jog | ||
_units : int = 12 | Jog | ||
_useSound : Boolean = false | Jog | ||
_val : Number = 0 | Jog | ||
valPriv : Number | Jog |
Method | Defined By | ||
---|---|---|---|
Jog() | Jog | ||
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. | Jog | ||
draw():void [override]
| Jog | ||
drawTicks():void
Routine draws the tick marks, when developer requests them drawn. | Jog | ||
genEvent(v:Number):void
Generate this component's event with the given value. | Jog | ||
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
Sets the position of the jog knob. | Jog | ||
trackMouse(me:MouseEvent):void
The routine that tracks mouse movements and converts them to jog movements. | Jog |
Event | Summary | Defined By | ||
---|---|---|---|---|
Event generated when jog knob is set as enabled == false. | Jog | |||
Event generated when jog knob value has changed. | Jog |
Constant | Defined By | ||
---|---|---|---|
CONST_180_OVER_PI : Number = 57.29577951308232 [static] | Jog | ||
DEGREE_PER_RADIAN : Number = 0.0174532925199433 [static] | Jog |
_backgroundClassName | property |
protected var _backgroundClassName:String = defJogBackground
_beginVal | property |
protected var _beginVal:Number
_clickSoundClass | property |
protected var _clickSoundClass:String = aClickSound
_discreteSteps | property |
protected var _discreteSteps:Boolean = false
_indicatorClassName | property |
protected var _indicatorClassName:String = defJogIndicator
_numTicks | property |
protected var _numTicks:int = 12
_showBkgnd | property |
protected var _showBkgnd:Boolean = true
_showHand | property |
protected var _showHand:Boolean = true
_showTicks | property |
protected var _showTicks:Boolean = false
_tickLineColor | property |
protected var _tickLineColor:int = 0
_tickLineThickness | property |
protected var _tickLineThickness:Number = 1
_turnByDragging | property |
public var _turnByDragging:Boolean = true
_units | property |
protected var _units:int = 12
_useSound | property |
protected var _useSound:Boolean = false
_val | property |
protected var _val:Number = 0
backgroundClassName | property |
backgroundClassName:String
Class name of the background Sprite
public function get backgroundClassName():String
public function set backgroundClassName(value:String):void
backgroundClip | property |
protected var backgroundClip:Sprite
baseAng | property |
protected var baseAng:Number
clickSoundClass | property |
clickSoundClass:String
Class name of the audio click. If you do not want a click, clear this field, or set useSound to false. The click is really only for when discreteSteps or snap-to-integer are in place -- otherwise the click sounds get garbled since a click sound is generated each value change (which may be quite small).
public function get clickSoundClass():String
public function set clickSoundClass(value:String):void
discreteSteps | property |
discreteSteps:Boolean
Whether jog moves in discrete steps (integers) or continuous.
public function get discreteSteps():Boolean
public function set discreteSteps(value:Boolean):void
evtChg | property |
public var evtChg:String = onValChg
Let user change the event names, if desired. The event name has to be set at the time the component is instantiated (either at run-time, or programmatically).
evtDisabled | property |
public var evtDisabled:String = onDisabled
Let user change the event names, if desired. The event name has to be set at the time the component is instantiated (either at run-time, or programmatically).
holdAng | property |
protected var holdAng:Number
holdAngSet | property |
protected var holdAngSet:Boolean
indicatorClassName | property |
indicatorClassName:String
Class name of the indicator Sprite
public function get indicatorClassName():String
public function set indicatorClassName(value:String):void
indicatorClip | property |
protected var indicatorClip:Sprite
knobContainer | property |
protected var knobContainer:Sprite
lastIntVal | property |
protected var lastIntVal:Number
numTicks | property |
numTicks:int
Number of tick marks to distribute around knob.
public function get numTicks():int
public function set numTicks(value:int):void
oldAng | property |
protected var oldAng:Number
showBkgnd | property |
showBkgnd:Boolean
Show or hide the background. Even if the background is hidden (alpha == 0, not visible == false), it is still used as a hit area for the knob. Therefore, if you want to set the hit area for the knob, you need to size the background appropriately, even if you set it to be hidden.
public function get showBkgnd():Boolean
public function set showBkgnd(value:Boolean):void
showHand | property |
showHand:Boolean
Show or hide the hand cursor
public function get showHand():Boolean
public function set showHand(value:Boolean):void
showTicks | property |
showTicks:Boolean
Whether or not to show the tick marks.
public function get showTicks():Boolean
public function set showTicks(value:Boolean):void
snap2Int | property |
public var snap2Int:Boolean = false
Snap the indicator to the closest integer position when user released mouse
sndObj | property |
protected var sndObj:Sound
tickLineColor | property |
tickLineColor:int
Tick line color (if showTicks is true).
public function get tickLineColor():int
public function set tickLineColor(value:int):void
tickLineThickness | property |
tickLineThickness:int
Tick line thickness (if showTicks is true).
public function get tickLineThickness():int
public function set tickLineThickness(value:int):void
tickSprite | property |
protected var tickSprite:Sprite
turnByDragging | property |
turnByDragging:Boolean
Whether interaction is by click-and-drag (true) or roll-over (false).
public function get turnByDragging():Boolean
public function set turnByDragging(value:Boolean):void
units | property |
units:int
Units in one revolution.
public function get units():int
public function set units(value:int):void
useSound | property |
useSound:Boolean
Whether or not to play the sound on a value change (default is false, do not play sound).
public function get useSound():Boolean
public function set useSound(value:Boolean):void
val | property |
val:Number
Starting value (from 0 to units
(number of units in 1 revolution).
public function get val():Number
public function set val(value:Number):void
valPriv | property |
protected var valPriv:Number
Jog | () | Constructor |
public function Jog()
changeBackground | () | method |
protected function changeBackground(n:String):void
Parameters
n:String |
changeIndicator | () | method |
protected function changeIndicator(n:String):void
Parameters
n:String |
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!
destroy | () | method |
public function destroy():void
Removes internal listeners and memory associated with the component.
draw | () | method |
override protected function draw():void
drawTicks | () | method |
protected function drawTicks():void
Routine draws the tick marks, when developer requests them drawn.
execEvent | () | method |
public function execEvent(evName:String, evVal:Number, q:Boolean):void
Given an event string and value that matches what this component would generate, perform the action. For the jog component, the event is onValChg and the value is the increment.
Parameters
evName:String — Event name (string) must match the event this component generates
| |
evVal:Number — (optional) value accompanying the event (if the event has an accompanying value)
| |
q:Boolean — (optional) set this to true if component should perform the action but not generate an event (this should be false or undefined, unless you know what you are doing)
|
genEvent | () | method |
protected function genEvent(v:Number):void
Generate this component's event with the given value. This is broken out as as a separate method so that it can be overriden in subclasses, if necessary.
Parameters
v:Number — current knob value
|
incrVal | () | method |
public function incrVal(incr:Number, q:Boolean):void
Increments the jog by incr units (positive or negative). This can be used to simulate turning the jog.
Parameters
incr:Number — Numeric increment to change the jog.
| |
q:Boolean — (optional) Set this to true to make the change without generating an event.
|
jogEngage | () | method |
protected function jogEngage(me:MouseEvent):void
Called when the operator is about to move the jog.
Parameters
me:MouseEvent |
jogRelease | () | method |
protected function jogRelease(me:MouseEvent):void
Called when the operator releases the jog from turning.
Parameters
me:MouseEvent |
playClick | () | method |
protected function playClick():void
rotZ | () | method |
protected function 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.
Parameters
vObj:Point — A Point (with properties x and y )
| |
ang:Number — Angle to rotate point on Z-axis (0 degrees points north, positive is clockwise)
|
setAVal | () | method |
protected function 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.
Parameters
ang:Number — ang
| |
realAng:Number — realAng
|
setClickSound | () | method |
protected function setClickSound(s:String):void
Parameters
s:String |
setupMouseEvents | () | method |
protected function setupMouseEvents():void
setVal | () | method |
protected function setVal(v:Number, q:Boolean = false):void
Sets the position of the jog knob.
Parameters
v:Number — Numeric value (between 0 and units )
| |
q:Boolean (default = false ) — Boolean flag indicating whether to set the value quietly (no event notification) or with notification (false [default]).
|
trackMouse | () | method |
protected function trackMouse(me:MouseEvent):void
The routine that tracks mouse movements and converts them to jog movements. We look at the current mouse position (the center of dial is (0, 0)) as a vector, and find out the angle between this vector and the angle recorded when the jog was last manipulated (holdAng). We then rotate the jog by the difference of the angles, then reset holdAng.
We have to invert the y axis values because in screen coords, y values increase going down, and decrease going up.
Developers shouldn't really use this method unless you know what you want to do with it.
Parameters
me:MouseEvent |
onDisabled | Event |
Event generated when jog knob is set as enabled == false
. You can change the name of the event in the evtDisabled
property.
onValChg | Event |
Event generated when jog knob value has changed. You can change the name of the event in the evtChg
property.
CONST_180_OVER_PI | Constant |
protected static const CONST_180_OVER_PI:Number = 57.29577951308232
DEGREE_PER_RADIAN | Constant |
protected static const DEGREE_PER_RADIAN:Number = 0.0174532925199433