Changing the data provider on the 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 data provider for the Flash ActionScript 3.0 ColorPicker component by setting the colors property.

Full code after the jump.

// ActionScript 3.0
/* Requires:
 * - ColorPicker control in Flash library
 */
var arr:Array = [0x000000, 0x110000, 0x220000, 0x330000, 
                 0x440000, 0x550000, 0x660000, 0x770000, 
                 0x880000, 0x990000, 0xAA0000, 0xBB0000, 
                 0xCC0000, 0xDD0000, 0xEE0000, 0xFF0000, // red
 
                 0x000000, 0x111111, 0x222222, 0x333333, 
                 0x444444, 0x555555, 0x666666, 0x777777,
                 0x888888, 0x999999, 0xAAAAAA, 0xBBBBBB,
                 0xCCCCCC, 0xDDDDDD, 0xEEEEEE, 0xFFFFFF]; //white
 
var colorPicker:ColorPicker = new ColorPicker();
colorPicker.colors = arr;
colorPicker.setStyle("columnCount", 16);
colorPicker.move(10, 10);
addChild(colorPicker);

{ 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:

Next post: