Packagecom.eqsim.components
Classpublic class Jog
InheritanceJog Inheritance fl.core.UIComponent
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 - background
  • defJogIndicator - indicator clip
  • You 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.



    Public Properties
     PropertyDefined 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
    Protected Properties
     PropertyDefined 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
    Public Methods
     MethodDefined 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
    Protected Methods
     MethodDefined 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
      
    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
    Events
     Event Summary Defined By
      Event generated when jog knob is set as enabled == false.Jog
      Event generated when jog knob value has changed.Jog
    Protected Constants
     ConstantDefined By
      CONST_180_OVER_PI : Number = 57.29577951308232
    [static]
    Jog
      DEGREE_PER_RADIAN : Number = 0.0174532925199433
    [static]
    Jog
    Property Detail
    _backgroundClassNameproperty
    protected var _backgroundClassName:String = defJogBackground

    _beginValproperty 
    protected var _beginVal:Number

    _clickSoundClassproperty 
    protected var _clickSoundClass:String = aClickSound

    _discreteStepsproperty 
    protected var _discreteSteps:Boolean = false

    _indicatorClassNameproperty 
    protected var _indicatorClassName:String = defJogIndicator

    _numTicksproperty 
    protected var _numTicks:int = 12

    _showBkgndproperty 
    protected var _showBkgnd:Boolean = true

    _showHandproperty 
    protected var _showHand:Boolean = true

    _showTicksproperty 
    protected var _showTicks:Boolean = false

    _tickLineColorproperty 
    protected var _tickLineColor:int = 0

    _tickLineThicknessproperty 
    protected var _tickLineThickness:Number = 1

    _turnByDraggingproperty 
    public var _turnByDragging:Boolean = true

    _unitsproperty 
    protected var _units:int = 12

    _useSoundproperty 
    protected var _useSound:Boolean = false

    _valproperty 
    protected var _val:Number = 0

    backgroundClassNameproperty 
    backgroundClassName:String

    Class name of the background Sprite


    Implementation
        public function get backgroundClassName():String
        public function set backgroundClassName(value:String):void
    backgroundClipproperty 
    protected var backgroundClip:Sprite

    baseAngproperty 
    protected var baseAng:Number

    clickSoundClassproperty 
    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).


    Implementation
        public function get clickSoundClass():String
        public function set clickSoundClass(value:String):void
    discreteStepsproperty 
    discreteSteps:Boolean

    Whether jog moves in discrete steps (integers) or continuous.


    Implementation
        public function get discreteSteps():Boolean
        public function set discreteSteps(value:Boolean):void
    evtChgproperty 
    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).

    evtDisabledproperty 
    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).

    holdAngproperty 
    protected var holdAng:Number

    holdAngSetproperty 
    protected var holdAngSet:Boolean

    indicatorClassNameproperty 
    indicatorClassName:String

    Class name of the indicator Sprite


    Implementation
        public function get indicatorClassName():String
        public function set indicatorClassName(value:String):void
    indicatorClipproperty 
    protected var indicatorClip:Sprite

    knobContainerproperty 
    protected var knobContainer:Sprite

    lastIntValproperty 
    protected var lastIntVal:Number

    numTicksproperty 
    numTicks:int

    Number of tick marks to distribute around knob.


    Implementation
        public function get numTicks():int
        public function set numTicks(value:int):void
    oldAngproperty 
    protected var oldAng:Number

    showBkgndproperty 
    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.


    Implementation
        public function get showBkgnd():Boolean
        public function set showBkgnd(value:Boolean):void
    showHandproperty 
    showHand:Boolean

    Show or hide the hand cursor


    Implementation
        public function get showHand():Boolean
        public function set showHand(value:Boolean):void
    showTicksproperty 
    showTicks:Boolean

    Whether or not to show the tick marks.


    Implementation
        public function get showTicks():Boolean
        public function set showTicks(value:Boolean):void
    snap2Intproperty 
    public var snap2Int:Boolean = false

    Snap the indicator to the closest integer position when user released mouse

    sndObjproperty 
    protected var sndObj:Sound

    tickLineColorproperty 
    tickLineColor:int

    Tick line color (if showTicks is true).


    Implementation
        public function get tickLineColor():int
        public function set tickLineColor(value:int):void
    tickLineThicknessproperty 
    tickLineThickness:int

    Tick line thickness (if showTicks is true).


    Implementation
        public function get tickLineThickness():int
        public function set tickLineThickness(value:int):void
    tickSpriteproperty 
    protected var tickSprite:Sprite

    turnByDraggingproperty 
    turnByDragging:Boolean

    Whether interaction is by click-and-drag (true) or roll-over (false).


    Implementation
        public function get turnByDragging():Boolean
        public function set turnByDragging(value:Boolean):void
    unitsproperty 
    units:int

    Units in one revolution.


    Implementation
        public function get units():int
        public function set units(value:int):void
    useSoundproperty 
    useSound:Boolean

    Whether or not to play the sound on a value change (default is false, do not play sound).


    Implementation
        public function get useSound():Boolean
        public function set useSound(value:Boolean):void
    valproperty 
    val:Number

    Starting value (from 0 to units (number of units in 1 revolution).


    Implementation
        public function get val():Number
        public function set val(value:Number):void
    valPrivproperty 
    protected var valPriv:Number

    Constructor Detail
    Jog()Constructor
    public function Jog()

    Method Detail
    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

    Event Detail
    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.

    Constant Detail
    CONST_180_OVER_PIConstant
    protected static const CONST_180_OVER_PI:Number = 57.29577951308232

    DEGREE_PER_RADIANConstant 
    protected static const DEGREE_PER_RADIAN:Number = 0.0174532925199433