| Package | flexlib.baseClasses |
| Class | public class SliderBase |
| Inheritance | SliderBase mx.core.UIComponent |
| Subclasses | ExtendedSlider |
Hide MXML Syntax| Property | Defined By | ||
|---|---|---|---|
| allowThumbOverlap : Boolean = false
If set to false, then each thumb can only be moved to the edge of
the adjacent thumb. | SliderBase | ||
| allowTrackClick : Boolean = true
Specifies whether clicking on the track will move the slider thumb. | SliderBase | ||
| dataTipFormatFunction : Function
Callback function that formats the data tip text. | SliderBase | ||
| direction : String
The orientation of the slider control. | SliderBase | ||
| labels : Array
An array of strings used for the slider labels. | SliderBase | ||
| liveDragging : Boolean = false
Specifies whether live dragging is enabled for the slider. | SliderBase | ||
| maximum : Number
The maximum allowed value on the slider. | SliderBase | ||
| minimum : Number
The minimum allowed value on the slider control. | SliderBase | ||
| showDataTip : Boolean = true
If set to true, show a data tip during user interaction
containing the current value of the slider. | SliderBase | ||
| sliderDataTipClass : Class
A reference to the class to use for the data tip. | SliderBase | ||
| sliderThumbClass : Class
A reference to the class to use for each thumb. | SliderBase | ||
| snapInterval : Number
Specifies the increment value of the slider thumb
as the user moves the thumb. | SliderBase | ||
| thumbCount : int
The number of thumbs allowed on the slider. | SliderBase | ||
| tickInterval : Number
The spacing of the tick marks relative to the maximum value
of the control. | SliderBase | ||
| tickValues : Array
The positions of the tick marks on the slider. | SliderBase | ||
| value : Number
Contains the position of the thumb, and is a number between the
minimum and maximum properties. | SliderBase | ||
| values : Array
An array of values for each thumb when thumbCount
is greater than 1. | SliderBase | ||
| Property | Defined By | ||
|---|---|---|---|
| thumbStyleFilters : Object [read-only]
Set of styles to pass from the Slider to the thumbs. | SliderBase | ||
| Method | Defined By | ||
|---|---|---|---|
Constructor. | SliderBase | ||
getThumbAt(index:int):SliderThumb
Returns the thumb object at the given index. | SliderBase | ||
setThumbValueAt(index:int, value:Number):void
This method sets the value of a slider thumb, and updates the display. | SliderBase | ||
| Method | Defined By | ||
|---|---|---|---|
measure():void [override]
Calculates the amount of space that the component takes up. | SliderBase | ||
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void [override]
Positions the elements of the control. | SliderBase | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when the slider changes value due to mouse or keyboard interaction. | SliderBase | |||
| Dispatched when the slider's thumb is pressed and then moved by the mouse. | SliderBase | |||
| Dispatched when the slider's thumb is pressed, meaning the user presses the mouse button over the thumb. | SliderBase | |||
| Dispatched when the slider's thumb is released, meaning the user releases the mouse button after a thumbPress event. | SliderBase | |||
| allowThumbOverlap | property |
public var allowThumbOverlap:Boolean = falseIf set to <codeph>false</codeph>, then each thumb can only be moved to the edge of the adjacent thumb. If <codeph>true</codeph>, then each thumb can be moved to any position on the track.
The default value is false.
| allowTrackClick | property |
public var allowTrackClick:Boolean = trueSpecifies whether clicking on the track will move the slider thumb.
The default value is true.
| dataTipFormatFunction | property |
dataTipFormatFunction:FunctionCallback function that formats the data tip text. The function takes a single Number as an argument and returns a formatted String. <p>The function has the following signature:</p> <pre> funcName(value:Number):String </pre> <p>The following example prefixes the data tip text with a dollar sign and formats the text using the <codeph>dataTipPrecision</codeph> of a Slider Control named 'slide': </p> <pre> import mx.formatters.NumberBase; function myDataTipFormatter(value:Number):String { var dataFormatter:NumberBase = new NumberBase(".", ",", ".", ""); return "$ " + dataFormatter.formatPrecision(String(value), slide.getStyle("dataTipPrecision")); } </pre>
The default value is undefined.
public function get dataTipFormatFunction():Function public function set dataTipFormatFunction(value:Function):void| direction | property |
direction:StringThe orientation of the slider control. Valid values in MXML are <codeph>"horizontal"</codeph> or <codeph>"vertical"</codeph>. <p>In ActionScript, you use the following constants to set this property: <codeph>SliderDirection.VERTICAL</codeph> and <codeph>SliderDirection.HORIZONTAL</codeph>.</p> The HSlider and VSlider controls set this property for you; do not set it when using those controls.
The default value is SliderDirection.HORIZONTAL.
public function get direction():String public function set direction(value:String):voidSee also
| labels | property |
labels:ArrayAn array of strings used for the slider labels. Flex positions the labels at the beginning of the track, and spaces them evenly between the beginning of the track and the end of the track. <p>For example, if the array contains three items, the first item is placed at the beginning of the track, the second item in the middle, and the last item at the end of the track.</p> <p>If only one label is specified, it is placed at the beginning of the track. By default, labels are placed above the tick marks (if present) or above the track. To align the labels with the tick marks, make sure that the number of tick marks is equal to the number of labels.</p>
The default value is undefined.
public function get labels():Array public function set labels(value:Array):void| liveDragging | property |
public var liveDragging:Boolean = falseSpecifies whether live dragging is enabled for the slider. If <codeph>false</codeph>, Flex sets the <codeph>value</codeph> and <codeph>values</codeph> properties and dispatches the <codeph>change</codeph> event when the user stops dragging the slider thumb. If <codeph>true</codeph>, Flex sets the <codeph>value</codeph> and <codeph>values</codeph> properties and dispatches the <codeph>change</codeph> event continuously as the user moves the thumb.
The default value is false.
| maximum | property |
maximum:NumberThe maximum allowed value on the slider.
The default value is 10.
public function get maximum():Number public function set maximum(value:Number):void| minimum | property |
minimum:NumberThe minimum allowed value on the slider control.
The default value is 0.
public function get minimum():Number public function set minimum(value:Number):void| showDataTip | property |
public var showDataTip:Boolean = trueIf set to <codeph>true</codeph>, show a data tip during user interaction containing the current value of the slider.
The default value is true.
| sliderDataTipClass | property |
sliderDataTipClass:ClassA reference to the class to use for the data tip.
The default value is SliderDataTip.
public function get sliderDataTipClass():Class public function set sliderDataTipClass(value:Class):void| sliderThumbClass | property |
sliderThumbClass:ClassA reference to the class to use for each thumb.
The default value is SliderThumb.
public function get sliderThumbClass():Class public function set sliderThumbClass(value:Class):void| snapInterval | property |
snapInterval:NumberSpecifies the increment value of the slider thumb as the user moves the thumb. For example, if <codeph>snapInterval</codeph> is 2, the <codeph>minimum</codeph> value is 0, and the <codeph>maximum</codeph> value is 10, the thumb snaps to the values 0, 2, 4, 6, 8, and 10 as the user move the thumb. A value of 0, means that the slider moves continuously between the <codeph>minimum</codeph> and <codeph>maximum</codeph> values.
The default value is 0.
public function get snapInterval():Number public function set snapInterval(value:Number):void| thumbCount | property |
thumbCount:intThe number of thumbs allowed on the slider. Possible values are 1 or 2. If set to 1, then the <codeph>value</codeph> property contains the current value of the slider. If set to 2, then the <codeph>values</codeph> property contains an array of values representing the value for each thumb.
The default value is 1.
public function get thumbCount():int public function set thumbCount(value:int):void| thumbStyleFilters | property |
thumbStyleFilters:Object [read-only] Set of styles to pass from the Slider to the thumbs.
protected function get thumbStyleFilters():ObjectSee also
| tickInterval | property |
tickInterval:NumberThe spacing of the tick marks relative to the <codeph>maximum</codeph> value of the control. Flex displays tick marks whenever you set the <codeph>tickInterval</codeph> property to a nonzero value. <p>For example, if <codeph>tickInterval</codeph> is 1 and <codeph>maximum</codeph> is 10, then a tick mark is placed at each 1/10th interval along the slider. A value of 0 shows no tick marks. If the <codeph>tickValues</codeph> property is set to a non-empty Array, then this property is ignored.</p>
The default value is 0.
public function get tickInterval():Number public function set tickInterval(value:Number):void| tickValues | property |
tickValues:ArrayThe positions of the tick marks on the slider. The positions correspond to the values on the slider and should be between the <codeph>minimum</codeph> and <codeph>maximum</codeph> values. For example, if the <codeph>tickValues</codeph> property is [0, 2.5, 7.5, 10] and <codeph>maximum</codeph> is 10, then a tick mark is placed in the following positions along the slider: the beginning of the slider, 1/4 of the way in from the left, 3/4 of the way in from the left, and at the end of the slider. <p>If this property is set to a non-empty Array, then the <codeph>tickInterval</codeph> property is ignored.</p>
The default value is undefined.
public function get tickValues():Array public function set tickValues(value:Array):void| value | property |
value:NumberContains the position of the thumb, and is a number between the <codeph>minimum</codeph> and <codeph>maximum</codeph> properties. Use the <codeph>value</codeph> property when <codeph>thumbCount</codeph> is 1. When <codeph>thumbCount</codeph> is greater than 1, use the <codeph>values</codeph> property instead. The default value is equal to the minimum property.
This property can be used as the source for data binding.
public function get value():Number public function set value(value:Number):void| values | property |
values:ArrayAn array of values for each thumb when <codeph>thumbCount</codeph> is greater than 1.
This property can be used as the source for data binding.
public function get values():Array public function set values(value:Array):void| SliderBase | () | Constructor |
public function SliderBase()Constructor.
| getThumbAt | () | method |
public function getThumbAt(index:int):SliderThumbReturns the thumb object at the given index. Use this method to style and customize individual thumbs in a slider control.
Parameters
index:int — The zero-based index number of the thumb.
|
SliderThumb — A reference to the SliderThumb object.
|
| measure | () | method |
override protected function measure():voidCalculates the amount of space that the component takes up. A horizontal slider control calculates its height by examining the position of its labels, tick marks, and thumbs relative to the track. The height of the control is equivalent to the position of the bottom of the lowest element subtracted from the position of the top of the highest element. The width of a horizontal slider control defaults to 250 pixels. For a vertical slider control, the width and the length measurements are reversed.
| setThumbValueAt | () | method |
public function setThumbValueAt(index:int, value:Number):voidThis method sets the value of a slider thumb, and updates the display.
Parameters
index:int — The zero-based index number of the thumb to set
the value of, where a value of 0 corresponds to the first thumb.
| |
value:Number — The value to set the thumb to
|
| updateDisplayList | () | method |
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):voidPositions the elements of the control. The track, thumbs, labels, and tick marks are all positioned and sized by this method. The track is sized based on the length of the labels and on the track margin. If you specify a <codeph>trackMargin</codeph>, then the size of the track is equal to the available width minus the <codeph>trackMargin</codeph> times 2. <p>Tick marks are spaced at even intervals along the track starting from the beginning of the track. An additional tick mark is placed at the end of the track if one doesn't already exist (if the tick interval isn't a multiple of the maximum value). The tick mark y-position is based on the <codeph>tickOffset</codeph>. An offset of 0 places the bottom of the tick at the top of the track. Negative offsets move the ticks upwards while positive offsets move them downward through the track.</p> <p>Labels are positioned at even intervals along the track. The labels are always horizontally centered above their interval position unless the <codeph>trackMargin</codeph> setting is too small. If you specify a <codeph>trackMargin</codeph>, then the first and last labels will position themselves at the left and right borders of the control. Labels will not crop or resize themselves if they overlap, so be sure to allow enough space for them to fit on the track. The y-position is based on the <codeph>labelOffset</codeph> property. An offset of 0 places the bottom of the label at the top of the track. Unlike tick marks, the labels can not be positioned to overlap the track. If the offset is a positive number, then the top of the label will be positioned below the bottom of the track.</p> <p>The thumbs are positioned to overlap the track. Their x-position is determined by their value. The y-position is controlled by the <codeph>thumbOffset</codeph> property. An offset of 0 places the center of the thumb at the center of the track. A negative offset moves the thumbs upwards while a positive offset moves the thumbs downwards.</p> <p>The placement of the tick marks, labels and thumbs are all independent from each other. They will not attempt to reposition themselves if they overlap.</p> <p>For a vertical slider control, the same rules apply. In the above description, substitute width for height, height for width, left for up or top, right for down or bottom, x-position for y-position, and y-position for x-position.</p>
Parameters
unscaledWidth:Number — Specifies the width of the component, in pixels,
in the component's coordinates, regardless of the value of the
<codeph>scaleX</codeph> property of the component.
| |
unscaledHeight:Number — Specifies the height of the component, in pixels,
in the component's coordinates, regardless of the value of the
<codeph>scaleY</codeph> property of the component.
|
| change | Event |
mx.events.SliderEventmx.events.SliderEvent.CHANGEDispatched when the slider changes value due to mouse or keyboard interaction. <p>If the <codeph>liveDragging</codeph> property is <codeph>true</codeph>, the event is dispatched continuously as the user moves the thumb. If <codeph>liveDragging</codeph> is <codeph>false</codeph>, the event is dispatched when the user releases the slider thumb.</p>
| thumbDrag | Event |
mx.events.SliderEventmx.events.SliderEvent.THUMB_DRAGDispatched when the slider's thumb is pressed and then moved by the mouse. This event is always preceded by a <codeph>thumbPress</codeph> event.
| thumbPress | Event |
mx.events.SliderEventmx.events.SliderEvent.THUMB_PRESSDispatched when the slider's thumb is pressed, meaning the user presses the mouse button over the thumb.
| thumbRelease | Event |
mx.events.SliderEventmx.events.SliderEvent.THUMB_RELEASEDispatched when the slider's thumb is released, meaning the user releases the mouse button after a <codeph>thumbPress</codeph> event.