1. Home
  2. Computing & Technology
  3. Animation

Deconstructing the Paint Application V: The RectangleTool

By Adrien-Luc Sanders, About.com

3 of 3

Behavior Defined on Mouse Release

Now all that remains is to redraw the rectangle when the mouse is released, this time on the main "drawing" movie clip and with a color reflecting the current active color:
if (_root.isactive=="rectangle"){
_root.drawing.lineStyle(0,_root.currentcolor,0) ;
_root.drawing.beginFill(_root.currentcolor,_root.base.opac) ;
_root.drawing.lineTo(_root.linex,_root._ymouse) ;
_root.drawing.lineTo(_root.linex,_root.liney) ;
_root.drawing.lineTo(_root._xmouse,_root.liney) ;
_root.drawing.lineTo(_root._xmouse,_root._ymouse) ;
_root.drawing.lineTo(_root.linex,_root._ymouse) ;
_root.drawing.endFill() ;
_root.rectracker.clear() ;
}

clear() clears out the rectangular tracker we'd used while the mouse was moving, while just as with the Oval Tool, beginFill() and endFill() fill in the rectangular with a solid color and opacity reflecting the current user settings.

Explore Animation
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Deconstructing the Paint Application V: The RectangleTool

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

All rights reserved.