ColorPicker in Flex4


 

ColorPicker in Flex4

The ColorPicker control is a MX component not a Spark component. When you can choose a color from it the swatch panel expands upward the application and after the selection of a color the swatch panel will be closed.

The ColorPicker control is a MX component not a Spark component. When you can choose a color from it the swatch panel expands upward the application and after the selection of a color the swatch panel will be closed.

ColorPicker control in Flex4:

The ColorPicker control is a MX component not a Spark component. When you can choose a color from it  the swatch panel expands upward the application and after the selection of a color the swatch panel will be closed.
If you set the showTextField property is true then a text box with label will be shown for a selected color.
The tag of ColorPicker is <mx:ColorPicker>.

Example:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx">

<s:Panel title="ColorPicker control Example" width="295" height="202">

<s:VGroup x="16" y="15" width="258">

<s:Label text="Choose Color:"/>

<mx:ColorPicker id="cpicker" selectedColor="0xFFFFFF"/>

<s:SkinnableContainer backgroundColor="{cpicker.selectedColor}"

 height="88" width="257">

</s:SkinnableContainer>

</s:VGroup>

</s:Panel>

</s:Application>

In this example you can see how we can use a ColorPicker control in Flex4.

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.


Download this code

Ads