The following example shows how you can get the currently selected color as a hexadecimal value on a Flash ActionScript 3.0 ColorPicker component by using the read-only hexValue property.
Full code after the jump.
// ActionScript 3.0 /* Requires: * - ColorPicker control in Flash library * - Label control in Flash library */ import fl.controls.ColorPicker; import fl.controls.Label; import fl.events.ColorPickerEvent; var colorPicker:ColorPicker = new ColorPicker(); colorPicker.addEventListener(ColorPickerEvent.CHANGE, colorPicker_change); colorPicker.move(10, 10); addChild(colorPicker); var lbl:Label = new Label(); lbl.text = colorPicker.hexValue; lbl.move(10, 40); addChild(lbl); function colorPicker_change(evt:ColorPickerEvent):void { lbl.text = colorPicker.hexValue; // ff0000 }
{ 0 comments… add one now }