Add an event listener for a change event and an open event to ColorPicker : ColorPicker « Components « Flex






Add an event listener for a change event and an open event to ColorPicker

Add an event listener for a change event and an open event to ColorPicker
       
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.events.DropdownEvent;
        import mx.events.ColorPickerEvent;
        [Bindable]
        public var simpleDP:Array = ['0x000000', '0xFF0000', '0xFF8800',
            '0xFFFF00', '0x88FF00', '0x00FF00', '0x00FF88', '0x00FFFF',
            '0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF', '0xFFFFFF'];
        public function openEvt(event:DropdownEvent):void {
            forChange.text="Opened";
        }
        public function changeEvt(event:ColorPickerEvent):void {
            forChange.text= event.currentTarget.selectedItem + " Selected Index: " + event.currentTarget.selectedIndex;
        }
      
    </mx:Script>
    <mx:VBox>
        <mx:TextArea id="forChange" width="150" />
        <mx:ColorPicker id="cp" dataProvider="{simpleDP}" open="openEvt(event);" change="changeEvt(event);" />
    </mx:VBox>
</mx:Application>

   
    
    
    
    
    
    
  








Related examples in the same category

1.ColorPicker change eventColorPicker change event
2.Get current selected color from ColorPickerGet current selected color from ColorPicker
3.Set color for ColorPickerSet color for 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