01 Mayıs 2010
Posted by admin
ColorPicker an Array of color, label, and description
The following example shows a ColorPicker that uses an Array of Objects with three fields: color, label, and description:
Turkish
bur örnek ile colorpicker içerisinde renklere isim ve açıklama ekleyebilirsiniz.
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ import mx.events.ColorPickerEvent; import mx.events.DropdownEvent; [Bindable] public var complexDPArray:Array = [ {label:"Yellow", color:"0xFFFF00", descript:"A bright, light color."}, {label:"Hot Pink", color:"0xFF66CC", descript:"It's HOT!"}, {label:"Brick Red", color:"0x990000", descript:"Goes well with warm colors."}, {label:"Navy Blue", color:"0x000066", descript:"The conservative favorite."}, {label:"Forest Green", color:"0x006600", descript:"Great outdoorsy look."}, {label:"Grey", color:"0x666666", descript:"An old reliable."}] public function openEvt(event:DropdownEvent):void { descriptBox.text=""; } public function changeEvt(event:ColorPickerEvent):void { descriptBox.text=event.currentTarget.selectedItem.label + ": " + event.currentTarget.selectedItem.descript; } ]]> </mx:Script> <mx:Style> .myStyle { swatchWidth:25; swatchHeight:25; textFieldWidth:95; } </mx:Style> <mx:ArrayCollection id="complexDP" source="{complexDPArray}"/> <mx:VBox> <mx:TextArea id="descriptBox" width="150" height="50"/> <mx:ColorPicker id="cp" height="50" width="150" dataProvider="{complexDP}" change="changeEvt(event);" open="openEvt(event);" editable="false"/> </mx:VBox> </mx:Application>
Demo :




No Comments Yet
You can be the first to comment!
Leave a comment