Share on Google+Share on Google+

Flex VSlider Control

In this tutorial we have illustrate how to create VSlider and how use it.

Slider in Flex:-

If user want to select a value between two end points by moving slider thumb. These point are on the slider track. You want to access the current value of the slider is find by the current location of the slider thumb between slider end points. In this example you can see how to create a Vslider in flex and how to access these current value. By default  the minimum value for the slider is 0 and the maximum value for the slider is can set the minimum and maximum value for these Vslider.

When you want to vertical slider the use Vslider control in flex. we can create Vslider in mxml by using <mx:Vslider>tag.


<?xml version="1.0"?>

<mx:Application xmlns:mx="">



import mx.controls.sliderClasses.Slider;


import mx.controls.Alert;

public function sliderValue(event:SliderEvent):void{

var slidervalue:Slider = Slider(event.currentTarget);

mytext.text = String(slidervalue.value);


public function DataTip(value:String):String{

return "Vslider value is "+ String(value);




<mx:Panel width="210" height="250" title="Vslider Example">


<mx:VSlider id="vslider"











<mx:Text text="Vslider Value Without Event"/>

<mx:Text text="{vslider.value}"/>



<mx:Text text="Vslider Value With Event"/>

<mx:Text id="mytext"/>




User can set the properties for Vslider. Some properties are set in this example for example tickInterval, these property set the tick mark for the Vslider and set the interval between the tick mark. The user can set the property for selection that is snapInterval which is use to select the value from the slider that is 0, 25, 50 etc. user can set the liveDragging property to give the live sliding process and use the property for Data tip is showDataTip is true.  showDataTip property is by default is true. You can also see how to set a user define data tip. But the main property of the slider is level that is display the start and end point for the slider. We can give these value in the level. 


In this example, we can use slider events. for example SliderEvent used to find the current value for the Vslider on change.



Posted on: April 5, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.