Animation

  1. Home
  2. Computing & Technology
  3. Animation

Deconstructing the Paint Application IIX: User Layers, Clear Layer

By Adrien-Luc Sanders, About.com

1 of 5

Setting Up Layer Buttons

We’ve worked out the basics of how the drawing is done in the Flash Oekaki/Paint Application, but what about where that drawing’s done? The application is set up a bit more complexly than a single canvas; instead it has two layers, and you can draw on either layer without affecting the one above or below. We’re going to take a look at how those layers are set up.

The first thing we need to do for this is set up the layer buttons. At the bottom of my application’s control panel I have two buttons, one marked 0, the other marked 1; the application opens with layer 0 active and the layer 0 button highlighted. Clicking the layer 1 button would make layer 0 inactive and make layer 1 active; clicking it a second time even while layer 1 was active would make layer 1 inactive and make layer 0 active. The same works in reverse for layer 0.

How is this done? Instead of testing strictly for true/false values of variables representing the layer activity, instead simply add the following code to each button:

on (release){
_root.layerzero=!_root.layerzero;
_root.layerone=!_root.layerone;
}

Assuming that one layer starts off true and the other false (something we’ll define in the next step), this code will always cause the two to switch when either button is clicked, because all it does is take the existing value of each one and convert it to its opposite.

I’ve only created two layers on mine, but you could create as many as you wished.

1 of 5

Index: Deconstructing the Paint Application IIX: User Layers, Clear Layer

  1. Setting Up Layer Buttons
  2. Creating Separate Movie Clips for Separate Layers
  3. Testing for Layer Activity: Layer 0
  4. Testing for Layer Activity: Layer 1
  5. Clear Layer

Explore Animation

More from About.com

Animation

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Deconstructing the Paint Application IIX: User Layers, Clear Layer

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

All rights reserved.