Creating a vertical Slider control in Flash using ActionScript 3.0

by Peter deHaan on March 5, 2009

in Slider

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).

Full code after the jump.

// 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;
}

{ 4 comments… read them below or add one }

1 Anonymous 08.07.09 at 4:26 pm

I tried it and it doesn’t work.

2 virend 01.05.10 at 7:29 pm

i want flash action script tutorials please provide me.

3 girish 01.31.10 at 10:49 pm

hi….. i am girish. please give me some of the action scripts which can be used for vertical or horizontal sliding of the images….

4 jayrizzasauce 02.11.10 at 8:34 pm

greetings… it is i, ahkmud amadeenagod, and i am requesting all of your actionscript files immediately to be sent here to me. you must send me everything you have so i can learn quickly. this is something you must do now because i command it. thank you many times in advance for your submission to my order…

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: