Setting the number of columns on a ColorPicker control in Flash using ActionScript 3.0

by Peter deHaan on December 23, 2008

in ColorPicker

The following example shows how you can set the number of columns on a Flash ActionScript 3.0 ColorPicker control’s pop up menu by setting the columnCount style.

Full code after the jump.

// ActionScript 3.0
/* Requires:
 * - ColorPicker control in Flash library
 * - Slider control in Flash library
 */
import fl.controls.ColorPicker;
import fl.controls.Slider;
import fl.events.SliderEvent;
 
var slider:Slider = new Slider();
slider.minimum = 9;
slider.maximum = 36;
slider.value = 18;
slider.snapInterval = 1;
slider.tickInterval = 1;
slider.liveDragging = true;
slider.addEventListener(SliderEvent.CHANGE, slider_change);
slider.width = 200;
slider.move(10, 10);
addChild(slider);
 
var colorPicker:ColorPicker = new ColorPicker();
colorPicker.move(10, 30);
addChild(colorPicker);
 
function slider_change(evt:SliderEvent):void {
    colorPicker.close();
    colorPicker.setStyle("columnCount", evt.value);
    colorPicker.open();
}

{ 0 comments… add one now }

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: Changing the data provider on the ColorPicker control in Flash using ActionScript 3.0

Next post: Creating a vertical Slider control in Flash using ActionScript 3.0