Programming Study
Make better life and live happy
Saturday, August 18, 2012
Creating a vertical Slider control in Flash using ActionScript 3.0
The following example shows how you can create a
horizontal or vertical Slider control in Flash using ActionScript 3.0 by
setting the Slider control’s direction property to one of the static constants
in the fl.controls.SliderDirection class (SliderDirection.HORIZONTAL or
SliderDirection.VERTICAL).
// ActionScript 3.0
import fl.controls.ComboBox;
import fl.controls.Slider;
import fl.controls.SliderDirection;
import fl.data.DataProvider;
var dp:DataProvider = new DataProvider();
dp.addItem({label:SliderDirection.HORIZONTAL});
dp.addItem({label:SliderDirection.VERTICAL});
var comboBox:ComboBox = new ComboBox();
comboBox.dataProvider = dp;
comboBox.selectedIndex = 1;
comboBox.move(20, 20);
comboBox.addEventListener(Event.CHANGE, comboBox_change);
addChild(comboBox);
var slider:Slider = new Slider();
slider.direction = SliderDirection.VERTICAL;
slider.move(20, 50);
addChild(slider);
function comboBox_change(evt:Event):void {
slider.direction =
comboBox.selectedItem.label;
}
Subscribe to:
Posts (Atom)