1. Home
  2. Computing & Technology
  3. Animation

Flash Coloring Book with setRGB

By Adrien-Luc Sanders, About.com

7 of 10

We want all of this to happen when the color is chosen by the user, and since the default method of user action is a mouse click, we’ll need an on (release) function:

on(release) {
_root.hue = 0x000000;
}

What this code does is define a variable named hue on the root level of the stage, and then set the value of hue to 0x000000 – which translates into black. When using hexadecimal values for colors in ActionScripting, always precede them with 0x instead of the # that you would use in HTML. So if we were working with red, we’d take the hex value for red – FF0000 – and turn it into 0xFF0000.

Don’t forget to put the _root. in front of the variable name; we’re going to be referencing this variable from another symbol, so we’ve got to make sure that it and the level that it operates on are clearly defined.

7 of 10

Index: Flash Coloring Book with setRGB

  1. Part 1
  2. Part 2
  3. Part 3
  4. Part 4
  5. Part 5
  6. Part 6
  7. Part 7
  8. Part 8
  9. Part 9
  10. Part 10

Explore Animation

More from About.com

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Flash “Coloring Book” with setRGB

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

All rights reserved.