My account
Shopping cart
Knowledge base
Support


Usage and Code Samples for Color Picker Pro V1 Flash Component



Color Picker Pro V1 Usage

1. Drag & Drop component to stage.
2. Name the component's instance in order to link it in your code.
3.From the parameters panel of the component set the preseted color, visible state and the type of the outline(verision) that you want to show: easy, pro, easypro(easy with pro button that allows to enlarge the color picker in runtime)
4. Using a listener, retreive onOk, onChange, onClose and onCopy events.
5. Use the .open(red,green,blue) and .close() in order to open the component(with preseted color) or to close it.

Example:
cp.open(255,0,0)
cp.close()


In order to use .open(r,g,b) function properly you need that the Color Picker Component to be completly initialized, so listen to the onLoad event too, call the .open(r,g,b) action after the onLoad is fired. The .open() function has priority over the default color (opened with default parameters) only if the visible state is turn off (false), else the default presetted color will load first.

Code Samples

listener = new Object();
cp.addListener(listener);
listener.onChange = function(message) {
hexacode=message;
color0xFormat="0x"+message.substr(1);
red=cp.red; // (0-255)
green=cp.green; // (0-255)
blue=cp.blue; // (0-255)
saturation=cp.saturation; // (0-100)
brightness = cp.brightnes; // (0-100)
hue = cp.hue; // (0-360)
hexacode =cp.hexa; // (#992288)
}

// The same code may be used for onCopy, onClose, onOk events too.
// You may also retreive color parameters anytime in your code without adding any listeners at all. You can use. for example, onEnterFrame event.