4 Replies Latest reply on Jun 12, 2009 8:12 AM by sam luke

    how to get and set a HSlider values

    sam luke Level 1

      hi,

        I havent used flex for a while and I am being a bit slow today.  My question is simple : How do I get and set my HSlider values in a class.  My HSlider lives in an mxml file and class lives in a seperate actionscript file.  First of all I want to get the value of the hslider.  I am using change property in the hslider to call a method in my class called Update(). In my class I have the function called Update() and within that use the id of the slider to get the value of it.  The compiler is complainiing of 1120: Access of undefined property hslider. I have provided an pseudo example below:

       

      mxml

              <mx:HSlider id="hslider" minimum="0" maximum="100" value="100" dataTipPlacement="top" tickColor="0x323232"
                                      snapInterval="1" tickInterval="10" allowTrackClick="true"
                                      liveDragging="true" change="aClass.Update()" />

      as file

              public function Update():void {
                  myVar = hslider.value / 100.0;
              }

       

      Thinking How do I then set the value of the hslider?