I was playing around with the HSlider component tonight and was checking out the allowThumbOverlap property. The following example creates a horizontal slider with 2 slider thumbs and lets you toggle the allowThumbOverlap property with the showTrackHighlight property set to true.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/22/using-overlapping-slider-thumbs-in-the-flex-slider-controls/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function list_labelFunc(item:Object):String {
return Number(item).toFixed(2);
}
]]>
</mx:Script>
<mx:Number id="slider_thumbCount">2</mx:Number>
<mx:ApplicationControlBar dock="true">
<mx:CheckBox id="checkBox"
label="allowThumbOverlap"
selected="true" />
</mx:ApplicationControlBar>
<mx:HSlider id="slider"
allowThumbOverlap="{checkBox.selected}"
dataTipPrecision="2"
showTrackHighlight="true"
snapInterval="0.25"
thumbCount="{slider_thumbCount}"
tickInterval="1" />
<mx:List id="list"
dataProvider="{slider.values}"
labelFunction="list_labelFunc"
rowCount="{slider_thumbCount}"
width="{slider.width}" />
</mx:Application>
View source is enabled in the following example.





hi,
This is really cool. I am very new to Flex, could you tell what has to be done in order to use this in a program.
Thanks,
Kiruthika
Kiruthika,
In Flex Builder, create a new Flex Project by selecting File > New > Flex Project from the main menu. Enter a Project name and click “Finish”. Copy and paste the code from above and paste into the MXML file in your Flex project. Finally, select Run > Run <project name> from the main menu to view the Flex application in a web browser.
Peter
Hi Peter,
I was wondering if you knew how to position the Thumbs so that they are at each end of the slider? For example on a single thumb slider you could use value=10.
Thanks,
jeff