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

5 of 8

Setting base values in scripts on the first frame

Before going any further, let’s set some base values for the overall movie.

Right-click the first (and should be the only) frame of the main timeline in your movie, and open the Actions panel. Your code, depending on how you set up your application, is going to look different from mine, but I’m going to show you mine and then explain what each variable does so you can work in your own version of it depending on the functionality of your application:

_root.currentcolor.0x000000;
stop( ) ;

_root.base.helptabs._visible=false;
_root.base.palette._visible=!_root.base.palette._visible;

_root.brushcursor.swapDepths(12) ;
_root.base.swapDepths(11) ;
_root.blueskin.swapDepths(10) ;

Now let’s break down what this does. _root.currentcolor is the variable that holds the value of the current active paint color, whether it’s applied to a brush or a shape tool; the color, if you’ll recall, is always read by Flash as the hexadecimal RGB value with “0x” appended in front of it. By setting _root.currentcolor to 0x000000, I’ve set the paint color to black by default when the application loads. The stop( ) ; ensures that my movie doesn’t recycle and reset these values after loading.

_root.base.helptabs._visible=false and _root.base.palette._visible=!_root.base.palette._visible determine the visibility of the movie clip containing my help files, and the movie clip containing the 228-color palette. Both should be hidden at the start of the movie, and should only be visible when something is clicked to activate them. I chose two different methods to hide them, though usually using !_visible is better.

The last section uses swapDepths to set the starting depths for the brush cursor, the default skin, and the menu.

5 of 8

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

  1. Starting Off
  2. Adding the layout
  3. Skins buttons
  4. Skins code
  5. Setting base values in scripts on the first frame
  6. The Canvas Color button
  7. Showing and hiding the help files
  8. Arranging the contents of the help files

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.