1. Home
  2. Computing & Technology
  3. Animation

Deconstructing the Paint Application V: The RectangleTool

By , About.com Guide

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

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. 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.