Animation

  1. Home
  2. Computing & Technology
  3. Animation

Deconstructing the Paint Application I: Setup, Skins, Canvas Color, Help File

By Adrien-Luc Sanders, About.com

6 of 8

The Canvas Color button

Next, let’s look at the Canvas Color button. This one is actually pretty easy; all you want it to do is change the fill color of the movie clip that acts as your background canvas whenever it’s clicked. We’ve done this before with the lesson on setRGB and how to change fill colors on movie clips:
on (release) {
canvasshade=new Color(_root.canvasbehind) ;
canvasshade.setRGB(_root.currentcolor) ;
_root.isactive=null;
}

You’ll notice that this uses _root.currentcolor again, the variable that reflects the current active color’s hex code; this script fetches the value of the currently selected paint color, and passes it to the setRGB function to change the canvas’s fill to that color.

You’ll also notice that there’s another variable there: _root.isactive. Clicking this tool sets that variable to null, meaning that it has no value assigned to it – but keep an eye on that, as it’s going to be as important as _root.currentcolor in upcoming lessons. _root.isactive is assigned a new value each time that a tool is clicked, and when drawing Flash checks the value of _root.isactive against conditional if statements to determine which behavior to follow.

You can ignore the additional part in the image about the rollover tooltips. All that does is use dynamic text to change the text inside the little tool title display at the top to reflect the tool name each time the mouse rolls over the button. It’s strictly optional, and fairly easy to figure out on your own.

6 of 8

Explore Animation

More from About.com

Animation

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Deconstructing the Paint Application I: Setup, Skins, Canvas Color, Help File

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

All rights reserved.