1. Computing

Deconstructing the Paint Application II: The Brush Tool & the Flash Drawing API

By

1 of 9

ActionScripting for the Brush Tool Button
Deconstructing the Paint Application II: The Brush Tool & the Flash Drawing API
Now that we’ve set up the base of the paint application and made the canvas color button work, let’s move on to the brush tool.

The first thing we’re going to do is define what happens when the brush tool is clicked. Mainly we just want Flash to know that the brush tool is now active - so that when it checks for certain conditions when the mouse is pressed, moved, or released, it knows how to behave. We’re again using that variable _root.isactive for this; last time we set the value to null/nothing, but this time we want to give it an actual value:

on (release) { 
_root.isactive = “brush”; 
}

©2014 About.com. All rights reserved.