1. Home
  2. Computing & Technology
  3. Animation

Deconstructing the Paint Application X: Color Palettes

By , About.com Guide

7 of 7

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.

Explore Animation
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Deconstructing the Paint Application X: Color Palettes

©2009 About.com, a part of The New York Times Company.

All rights reserved.