2 Replies Latest reply on Dec 2, 2010 12:20 PM by Morkus53

    How to update a text control from an HSlider?

    Morkus53

      Hello,

       

      I have an issue where I have a text control next to an HSlider to persist the slider's value.

       

      When the form comes up, the text control is 0 (zero).

       

      Yet, I successfully have the slider modifying the text control as the user slides it.

       

      -----

       

      So my question is...how can I update the text control when the form loads so the text control has the current non-zero value of the Slider before the user moves the slider?

       

      I'm trying code like below:

       

      // Trying to use creationComplete in HSlider mxml:

       

      <mx:HSlider> ..... creationComplete="initControl(slider.value);" />

       

      ---------

       

      Then, in the form's method initControl() called by the slider above, I have this code:

       

          private function initControl(value:Number):void
              {
                 
                  textControl1.text = String(value.toString());    
              }

       

      -----

       

      However, when initiControl runs, the value that's passed in is zero. The Hslider's value is 55.

       

      Am I using the wrong idea here or is this close to being correct?

       

      I'd appreciate any insights or ideas.

       

      Thanks.

       

      -- M