PDA

View Full Version : Disable slider thumb


tazboy
05-03-2009, 04:57 AM
I have a slider with two thumbs. I want one of the thumbs to not be able to move. Is there a way to do this?

JeTSpice
05-03-2009, 07:36 PM
this might point you in the right direction:

<?xml version="1.0"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>
<![CDATA[
import mx.events.SliderEvent;
import mx.controls.sliderClasses.Slider;

private function hSliderChange(evt:SliderEvent):void
{
var s:Slider = Slider(evt.currentTarget);
s.value = 5;
}
]]>
</mx:Script>
<mx:HSlider id="hSlider"
thumbCount="2"
change="hSliderChange(event)"/>
</mx:Application>

tazboy
05-04-2009, 02:13 AM
Thanks. That worked.

If I'm using two thumbs how do I just make it so one of them is non-movable? I know there is a thumbIndex property but I'm not sure I can use it. I also saw something like slider.value[0] and slider.value[1] to denote the first and second thumb, respectively. Anyone ever figure this out?

Thanks for the continued help. It's greatly appreciated.

JeTSpice
05-04-2009, 02:25 PM
hm, not sure. you might check to see that when a thumb is depressed, if it is thumb #1 then set liveDragging to false, and on thumb release, always set liveDragging to true.