1 Reply Latest reply on Oct 1, 2009 9:59 PM by ShardulSingh

    Hide slider thumb

    Dharmesh Chheda Level 1

      I am not able to hide the slider thumbs for a slider.


      Here is a sample of what I am doing

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

           <mx:Script>
              <![CDATA[
                  public function disableSlider():void{
                      salesSizeSlider.enabled=false;
                      salesSizeSlider.getThumbAt(0).visible=false;
                      salesSizeSlider.getThumbAt(1).visible=false;
                  }
              ]]>
          </mx:Script>

      <mx:HSlider id="salesSizeSlider"  x="10" y="83" width="190" allowTrackClick="false" liveDragging="true"
                          showDataTip="false"  labelOffset="-10" thumbCount="2"
                          minimum="0" maximum="200" values="[0,200]" />


      <mx:Button x="203" y="197" label="Disable Slider" click="disableSlider()"/>

      </mx:Application>

       

      The above application hides the thumbs .. but If i add

      this line as the first statement in the disableSlider() method, the sliders do not hide.

       

      salesSizeSlider.values=[1,90];

       

      Any idea why .. I always set the slider values based on data from backend and if the values are equal then I need to hide the thumbs..

       

      Thanks

      Dharmesh

        • 1. Re: Hide slider thumb
          ShardulSingh Level 3

          Hi,

          Pls find the solution for your problem.Let me know if you have any issue.

           

           

          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="getDataFromYourBackend()">

               <mx:Script>

                  <![CDATA[

                      private var firstThumbValue : Number;

                      private var secondThumbValue : Number;

                 

                      public function disableSlider():void{

                          salesSizeSlider.getThumbAt(0).visible=false;

                          salesSizeSlider.getThumbAt(1).visible=false;

                      }

                     

                      private function getDataFromYourBackend():void

                      {

                            //set the slider varibles here as per the backend value.It's simply for demonstration                   //  here.

                            firstThumbValue = 1;

                            secondThumbValue = 90;

                            if(firstThumbValue != secondThumbValue)

                            {

                                  //Do not write this line for the case when your values are equal i.e. inside else                         //block.

                                  salesSizeSlider.values=[firstThumbValue,secondThumbValue];

                            }

                            else

                            {

                                  salesSizeSlider.getThumbAt(0).visible=false;

                            salesSizeSlider.getThumbAt(1).visible=false;   

                            }

                      }

                  ]]>

              </mx:Script>

           

          <mx:HSlider id="salesSizeSlider"  x="10" y="83" width="190" allowTrackClick="false" liveDragging="true"

                              showDataTip="false"  labelOffset="-10" thumbCount="2"

                              minimum="0" maximum="200" values="[0,200]" />

           

           

          <mx:Button x="203" y="197" label="Disable Slider" click="disableSlider()"/>

           

          </mx:Application>

           

           

           

           

           

           

          with Regards,

          Shardul Singh Bartwal