To work effectively with complex graphics, you need to understand how Flash shapes interact when they are on the same layer or on different layers. In this chapter, you learn how to work with multiple shapes on one layer.

This chapter is from the book

In chapters 2 and 3, you learned to make simple individual shapes from lines
(strokes) and fills by using Macromedia Flash MX's drawing tools. You
learned to make a single oval and a lone rectangle, for example. In your movies,
you'll want to use many shapes together, and you'll need to combine
strokes and fills in complex ways. You might combine several ovals and
rectangles to create a robot character, for example. To work effectively with
complex graphics, you need to understand how Flash shapes interact when they are
on the same layer or on different layers. In this chapter, you learn how to work
with multiple shapes on one layer. To learn more about the concept of layers,
see Chapter 5.

Two of Flash's drawing toolsthe brush tool and the
eraseroffer special modes for use with multiple fills and strokes on a
single layer. In this chapter, unless you are specifi-cally requested to do
otherwise, leave both tools at their default settings of Paint Normal (for the
brush tool) and Erase Normal (for the eraser).

When Lines Intersect Lines

If you draw several lines on the same layer, they interact. Draw a new line
across an existing one, and the new line cutsor, in Flash terminology,
segmentsthe old. Segmentation happens whether the lines are the
same color or different colors, but it's easiest to see with contrasting
colors.

To see how one line segments another:

In the Toolbox, choose the pencil tool.

In the Pencil Tool Properties Inspector, do the
following:

Set the stroke style to Solid.

Set the stroke height to 4 points.

Set the color to blue.

On the Stage, draw a line.

Click the stroke-color box (in the Toolbox or in the Property Inspector),
and from the pop-up swatch set, choose a new color, such as red.

On the Stage, draw a second line; make it intersect your first line at
least once. Flash segments the line. To see the segments, select various parts
of the line with the arrow tool (Figure 4.1).

Figure 4.1 When you draw one line across another, every intersection creates a separate segment.

The Mystery of the Stacking Order for Strokes

When drawing one line on top of another, you might expect that the last line
drawn would wind up on top, but sometimes, that's not the case. In this
exercise about intersecting lines, for example, if you start with a red line and
then draw a blue line across it, you'll see that the blue line jumps behind
the red one when you release the mouse button.

Flash creates a stacking order for lines based on the hex-color value of the
line's stroke-color setting. The higher the hex value of the stroke
color, the higher the line sits in a stack of lines drawn on the Stage.
A line whose stroke color is set to a hex value of 663399 always winds up
on top of a stroke whose color is set to 333399.