public static const THUMB:String = "thumb"
Language Version : | ActionScript 3.0 |
Player Version : | Flash Player 9.0.28.0 |
The Slider thumb was clicked.
public static const TRACK:String = "track"
Language Version : | ActionScript 3.0 |
Player Version : | Flash Player 9.0.28.0 |
The Slider track was clicked.
This example demonstrates how to determine whether a Slider instance has been clicked on the thumb or on the track of the slider.
To run the example, follow these steps:
- Drag a Slider onto the Stage and name it
slider
.
- Drag a Label component onto the Stage and name it
sliderLabel
.
- Save this code as SliderEventClickTargetExample.as in the same directory as your FLA file.
- Set the Document class in the FLA file to SliderEventClickTargetExample.
package
{
import fl.events.SliderEvent;
import fl.events.SliderEventClickTarget;
import flash.display.Sprite;
import flash.text.TextFieldAutoSize;
public class SliderEventClickTargetExample extends Sprite
{
public function SliderEventClickTargetExample() {
slider.addEventListener(SliderEvent.CHANGE, analyzeSliderInput);
sliderLabel.autoSize = TextFieldAutoSize.LEFT;
sliderLabel.text = "Select and move slider with keyboard or mouse";
}
private function analyzeSliderInput(e:SliderEvent):void {
switch(e.clickTarget) {
case SliderEventClickTarget.THUMB:
sliderLabel.text = "Slider has been clicked on the thumb";
break;
case SliderEventClickTarget.TRACK:
sliderLabel.text = "Slider has been clicked on the track";
break;
default:
break;
}
}
}
}