Packagecom.eqsim.components
Classpublic class Potentiometer
InheritancePotentiometer Inheritance Jog Inheritance fl.core.UIComponent

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 - background
  • defPotIndicator - 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 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.



    Public Properties
     PropertyDefined By
     InheritedbackgroundClassName : String
    Class name of the background Sprite
    Jog
     InheritedclickSoundClass : String
    Class name of the audio click.
    Jog
     InheriteddiscreteSteps : Boolean
    Whether jog moves in discrete steps (integers) or continuous.
    Jog
     InheritedevtChg : String = onValChg
    Let user change the event names, if desired.
    Jog
     InheritedevtDisabled : String = onDisabled
    Let user change the event names, if desired.
    Jog
     InheritedindicatorClassName : 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
     InheritednumTicks : int
    Number of tick marks to distribute around knob.
    Jog
     InheritedshowBkgnd : Boolean
    Show or hide the background.
    Jog
     InheritedshowHand : Boolean
    Show or hide the hand cursor
    Jog
     InheritedshowTicks : Boolean
    Whether or not to show the tick marks.
    Jog
     Inheritedsnap2Int : Boolean = false
    Snap the indicator to the closest integer position when user released mouse
    Jog
     InheritedtickLineColor : int
    Tick line color (if showTicks is true).
    Jog
     InheritedtickLineThickness : int
    Tick line thickness (if showTicks is true).
    Jog
     Inherited_turnByDragging : Boolean = true
    Jog
     InheritedturnByDragging : Boolean
    Whether interaction is by click-and-drag (true) or roll-over (false).
    Jog
     Inheritedunits : int
    Units in one revolution.
    Jog
     InheriteduseSound : Boolean
    Whether or not to play the sound on a value change (default is false, do not play sound).
    Jog
     Inheritedval : Number
    Starting value (from 0 to units (number of units in 1 revolution).
    Jog
    Protected Properties
     PropertyDefined By
     Inherited_backgroundClassName : String = defJogBackground
    Jog
     InheritedbackgroundClip : Sprite
    Jog
     InheritedbaseAng : Number
    Jog
     Inherited_beginVal : Number
    Jog
     Inherited_clickSoundClass : String = aClickSound
    Jog
     Inherited_discreteSteps : Boolean = false
    Jog
     InheritedholdAng : Number
    Jog
     InheritedholdAngSet : Boolean
    Jog
     Inherited_indicatorClassName : String = defJogIndicator
    Jog
     InheritedindicatorClip : Sprite
    Jog
     InheritedknobContainer : Sprite
    Jog
     InheritedlastIntVal : Number
    Jog
     Inherited_numTicks : int = 12
    Jog
     InheritedoldAng : Number
    Jog
     Inherited_showBkgnd : Boolean = true
    Jog
     Inherited_showHand : Boolean = true
    Jog
     Inherited_showTicks : Boolean = false
    Jog
     InheritedsndObj : Sound
    Jog
     Inherited_tickLineColor : int = 0
    Jog
     Inherited_tickLineThickness : Number = 1
    Jog
     InheritedtickSprite : Sprite
    Jog
     Inherited_units : int = 12
    Jog
     Inherited_useSound : Boolean = false
    Jog
     Inherited_val : Number = 0
    Jog
     InheritedvalPriv : Number
    Jog
    Public Methods
     MethodDefined By
      
    Potentiometer
     Inherited
    destroy():void
    Removes internal listeners and memory associated with the component.
    Jog
     Inherited
    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
     Inherited
    incrVal(incr:Number, q:Boolean):void
    Increments the jog by incr units (positive or negative).
    Jog
    Protected Methods
     MethodDefined By
     Inherited
    changeBackground(n:String):void
    Jog
     Inherited
    changeIndicator(n:String):void
    Jog
      
    configUI():void
    [override] configUI Get the display objects created in preparation of launch.
    Potentiometer
     Inherited
    draw():void
    [override]
    Jog
     Inherited
    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
     Inherited
    jogEngage(me:MouseEvent):void
    Called when the operator is about to move the jog.
    Jog
     Inherited
    jogRelease(me:MouseEvent):void
    Called when the operator releases the jog from turning.
    Jog
     Inherited
    playClick():void
    Jog
     Inherited
    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
     Inherited
    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
     Inherited
    setClickSound(s:String):void
    Jog
     Inherited
    Jog
      
    setVal(v:Number, q:Boolean = false):void
    [override] Sets the position of the potentiometer.
    Potentiometer
     Inherited
    trackMouse(me:MouseEvent):void
    The routine that tracks mouse movements and converts them to jog movements.
    Jog
    Events
     Event Summary Defined By
      Potentiometer
      Event generated when jog knob value has changed.Potentiometer
    Protected Constants
     ConstantDefined By
     InheritedCONST_180_OVER_PI : Number = 57.29577951308232
    [static]
    Jog
     InheritedDEGREE_PER_RADIAN : Number = 0.0174532925199433
    [static]
    Jog
    Property Detail
    maxValproperty
    maxVal:Number

    Set the maximum value for this knob.


    Implementation
        public function get maxVal():Number
        public function set maxVal(value:Number):void
    minValproperty 
    minVal:Number

    Set the minimum value for this knob.


    Implementation
        public function get minVal():Number
        public function set minVal(value:Number):void
    Constructor Detail
    Potentiometer()Constructor
    public function Potentiometer()

    Method Detail
    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]).

    Event Detail
    onDisabled Event

    onValChg Event  

    Event generated when jog knob value has changed.