Recipe 1.7. Customizing Line Caps


Problem

You want to change the style applied to the ends of line segments.

Solution

Change the line Cap style in the Property inspector.

Discussion

For most of its lifetime Flash has had exactly one line cap style: rounded. The rounded caps on lines are appropriate for many things, but not for everything. For example, when you draw a rectangle using round line caps, the corners of the rectangle are slightly rounded. Starting with Flash 8, however, Flash allows you to select the line Cap style in the Property inspector. You can select from None, Round (default), and Square.

When you select None, the line is drawn as a rectangular area with exactly the length specified. When you select Round or Square, Flash adds a cap to each end of the line segment. The end cap extends beyond the end of the line segment by half of the line thickness. For example, if the line thickness is 10, the caps extend 5 pixels past the ends of the line segment. In the case of Round, the caps are semicircles. In the case of Square, the caps are semisquares (also known as rectangles).

You can change the Cap style for any line after it's been drawn. However, note that changing the Cap style can have an effect on the Join style.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net