Get current selected color from ColorPicker : ColorPicker « Components « Flex






Get current selected color from ColorPicker

Get current selected color from ColorPicker
  
<?xml version='1.0' encoding='UTF-8'?>
<mx:Application
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        import mx.controls.Alert; 
        public function showMsg(msg:String):void { 
            Alert.show(msg); 
        }
    </mx:Script>
    <mx:Panel width="400" height="150" title="Profile" horizontalCenter="0" verticalCenter="0">

        <s:HGroup>
            <mx:Label fontWeight="bold" text="Favorite car maker:" />
            <s:DropDownList id="combo" close="showMsg('Value is ' + event.currentTarget.selectedItem)">
                <mx:ArrayCollection>
                    <mx:String>A</mx:String>
                    <mx:String>B</mx:String>
                    <mx:String>C</mx:String>
                </mx:ArrayCollection>
            </s:DropDownList>
            <mx:Label fontWeight="bold" text="With the color of:" />
            <mx:ColorPicker id="clr" change="showMsg('Color ' + event.currentTarget.selectedColor)" />
        </s:HGroup>

    </mx:Panel>
</mx:Application>

   
    
  








Related examples in the same category

1.ColorPicker change eventColorPicker change event
2.Set color for ColorPickerSet color for ColorPicker
3.Add an event listener for a change event and an open event to ColorPickerAdd an event listener for a change event and an open event to ColorPicker
4.ColorPicker uses an Array of Objects with three fields: color, label, and descript.ColorPicker uses an Array of Objects with three fields: color, label, and descript.
5.Bind HBox backgroundColor to ColorPicker colorValueBind HBox backgroundColor to ColorPicker colorValue
6.GridItem Label, ColorPickerGridItem Label, ColorPicker
7.Use ControlBar to wrap ColorPicker and Button
8.Change panel style in ColorPicker change eventChange panel style in ColorPicker change event
9.Use a ColorPicker to Set Canvas ColorUse a ColorPicker to Set Canvas Color
10.Populate a ColorPicker with a simple array of colors.Populate a ColorPicker with a simple array of colors.
11.ColorPicker EventsColorPicker Events
12.A ColorPicker uses an Array of Objects with three fields: color, label, and descriptA ColorPicker uses an Array of Objects with three fields: color, label, and descript
13.ColorPicker with Custom Field NamesColorPicker with Custom Field Names