1. Home
  2. Computing & Technology
  3. Animation

Flash “Coloring Book” with setRGB

By , About.com Guide

10 of 10

Let’s use on(release) and setRGB again, only this time without having to define a variable:

on(release) {
fillshade = new Color (_root.rightarm) ;
fillshade.setRGB(_root.hue) ;
}

What this has done is define another new color function, fillshade, and assigned it to the instance on the stage named rightarm. Now Flash knows that when the mouse clicks and then releases on that fill, it needs to change the RGB value to the hex value of _root.hue – which, you’ll recall, we set up on the palette to change to whatever color we click on. This is why we needed to make sure that the variable was defined as _root.hue and not just hue, so we could call it from inside another movie clip’s ActionScripts.

Repeat this for each fill area, just changing the instance name where the new color is defined, and you should be done and ready to paint. Click here to see the preview version and how it should work. Or, if you’d like a bit more visibility, the massively, insanely large version is here.

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. Flash “Coloring Book” with setRGB

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

All rights reserved.