
1. Re: Help me on HSlider with two thumbs
BhaskerChari Jul 9, 2010 3:46 AM (in response to SVenu_2703)Hi Venu,
Can you post the code that you are working reproducing your problem..?
Normally HSlider won't allow its thumbs to be dragged reverse of another one...
Thanks ,
Bhasker Chari

2. Re: Help me on HSlider with two thumbs
SVenu_2703 Jul 9, 2010 5:13 AM (in response to BhaskerChari)Hi Bhasker,
Thanks for immediate response.
Here is my code:
package
{
import mx.controls.HSlider;
import mx.controls.sliderClasses.SliderThumb;
import mx.core.mx_internal;
use namespace mx_internal;
public class CustonSlider extends HSlider
{
public function CustonSlider ()
{
}
override mx_internal function getSnapValue(value:Number, thumb:SliderThumb = null):Number
{
if (!isNaN(snapInterval) && snapInterval != 0)
{
var val:Number = getValueFromX(value);
trace("value min max val "+value+" "+minimum+" "+maximum+" "+val);
//if (thumb && (thumbs.numChildren > 1) && !allowThumbOverlap)
if (thumb && (2 > 1) && !allowThumbOverlap)
{
var check_bounds:Boolean = true;
var bounds:Object
bounds = getXBounds(thumb.thumbIndex);
var prevThumb:SliderThumb =
thumb.thumbIndex > 0 ?
//SliderThumb(thumbs.getChildAt(thumb.thumbIndex 1)) :
SliderThumb(getThumbAt(thumb.thumbIndex 1)) :
null;
var nextThumb:SliderThumb =
//thumb.thumbIndex + 1 < thumbs.numChildren ?
thumb.thumbIndex + 1 < 2 ?
//SliderThumb(thumbs.getChildAt(thumb.thumbIndex + 1)) :
SliderThumb(getThumbAt(thumb.thumbIndex + 1)) :
null;
if (prevThumb)
{
bounds.min = (prevThumb.width / 2);
trace("bounds.min "+bounds.min);
// check if thumb is at minimum, if not we can ignore the bounds logic
if (val == minimum)
if (getValueFromX((prevThumb.xPosition  prevThumb.width/2)) <= minimum)
check_bounds =
false;
}
else
{
if (val >= minimum)
check_bounds =
false;
}
if (nextThumb)
{
bounds.max += (nextThumb.width / 2);
trace("bounds.max "+bounds.max);
// check if thumb is at maximum, if not we can ignore the bounds logic
if (val == maximum)
if (getValueFromX((nextThumb.xPosition + nextThumb.width/2)) >= maximum)
check_bounds =
false;
}
else
{
if (val <= maximum)
check_bounds =
false;
}
trace("check_bounds : "+check_bounds);
if (check_bounds)
val = Math.min(Math.max(val, getValueFromX(Math.round(bounds.min)) + snapInterval),
getValueFromX(Math.round(bounds.max))  snapInterval);
}
return getXFromValue(val);
}
return value;
}
}
}
I am calling the above snippet in my application.
But it is not working as i expected. Let us consider two thumbs as left thumb and right thumb, the left thumb should not move to right and rite thumb should move to right thumb. I can achieve this functionality if i set the boolean property "allowThumbOverlap" to false. But if i did this i cannot select range between 11 0r 44 or 99 etc. I have to give a chance to select range between 11 or 44 or 99 etc
Message was edited by: SVenu_2703

3. Re: Help me on HSlider with two thumbs
SVenu_2703 Jul 14, 2010 12:38 AM (in response to SVenu_2703)Friends,
Can i have a solutions for this. I need it very urgent.
Thanks,
Venu S.