Value Selectors

Value selectors are components that allow the user to select a value. This is a fairly diverse category of components because the types of values they allow the user to select and the ways in which they allow the user to select the values are quite different. Figure 7-3 shows the basic value selector components (except for VSlider, because it is the vertical version of HSlider, which is shown).

Value selector components

Figure 7-3. Value selector components

The slider components (HSlider and VSlider) differ only in that one is horizontal and one is vertical. Otherwise, they behave identically. The slider components allow the user to select a numeric value along a range from a minimum to a maximum value. The default range is 0 to 10, but you can adjust the range using the minimum and maximum properties. The slider components allow the user to drag a thumb along that range. Optionally, you can add more than one thumb and allow the user to select a range of values. Use the thumbCount property to specify the number of thumbs. The following example adds a new thumb when the user clicks on the button:

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Script> <![CDATA[ private function addThumb():void { hslider.thumbCount++; } ]]> </mx:Script> <mx:HSlider id="hslider" /> <mx:Button label="Add Thumb" click="addThumb();" /> </mx:Application> ...

Get Programming Flex 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.