1. Computing & Technology

Discuss in my forum

Deconstructing the Paint Application X: Color Palettes

By , About.com Guide

Lastly we need to pass hexcolor - whether it’s coming from the basic palette, the expanded palette, or the input box - to another variable that adds on the 0x in front of the hexadecimal code so that it reads in Flash’s standard format (0x000000). This is where the currentcolor variable that I’m so fond of comes in.
onClipEvent (enterFrame) { 
_root.currentcolor=”0x”+_root.base.hexcolor; 
boxcolor=new Color (_root.base.colorbox); 
boxcolor.setRGB (_root.base.currentcolor); 
_root.base.colorbox._alpha=_root.base.opac; 
}

This script is assigned to a controller movie clip so that it checks the value of hexcolor each time it cycles through its single frame, adds a 0x in front of it, and assigns it to the variable currentcolor for use with the various tools. Then it uses setRGB to create a new Color function that controls the fill of the active color swatch (movie clip instance name colorbox).

That’s it for the color palette.

©2012 About.com. All rights reserved.

A part of The New York Times Company.