Chapter 5. Complex Graphics on a Single Layer


5. Complex Graphics on a Single Layer

In Chapters 2 and 4, you learned to make and modify simple individual shapes from lines (strokes) and fills by using Macromedia Flash 8's drawing tools. 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 shapes, such as ovals and rectangles, to create a robot character, for example. To work effectively with complex graphics, you must understand how multiple graphic elementsboth merge-shapes and drawing objectsinteract when they're on the same layer or on different layers. In this chapter, you learn how to work with multiple graphic elements on one layer in a Flash document. To learn more about the concept of layers, see Chapter 6.

Two of Flash's drawing toolsthe brush tool and the eraseroffer special modes for use with multiple fills and strokes on a single layer. In this chapter, unless you're specifically 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 Merge-Shapes Interact

You can think of each frame in a Flash movie as being a stack of transparent acetate sheets. In Flash terms, each sheet is a layer. Graphics on different layers have a depth relationship: Items on higher layers block your view of items on lower layers, just as a drawing on the top sheet of acetate would obscure drawings on lower sheets.

Imagine that you have two layers in your movie. If you draw a little yellow square on the bottom layer and then switch to the top layer and draw a big red square directly over the yellow one, the little square remains intact, but you can't see it. The square on the top layer is in the way.

On a single layer in Flash, however, merge-shapes interact with one another, almost as though you were painting with wet finger paint. Here's a quick run down of how lines (strokes) and shapes (fills) created in Merge Drawing mode interact within a single layer.

When Merge-Shape Lines Intersect

Intersecting merge-shape lines drawn on the same layer affect one another. Draw one line in Merge Drawing mode, and then draw a second line that intersects the first. The second line cutsor, in Flash terminology, segmentsthe first. Segmentation happens whether the lines are the same color or different colors, but it's easiest to see with contrasting colors (Figure 5.1).

Figure 5.1. When you draw one line across another in Merge Drawing mode, every intersection creates a separate segment.


You might expect that the second line you drew would wind up on top of the first, but sometimes, that's not the case. Start with a red line, and then draw a blue line across it; the blue line jumps behind the red one when you release the mouse button. Flash creates a stacking order for merge-shape 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 merge-shape lines drawn on the Stage. A merge-shape line whose stroke color is set to a hex value of 663399 always winds up on top of one whose stroke color is set to 333399.

When Merge-Shape Lines and Fills Intersect

Even the invisible outlines that describe painted brush-stroke fills can cut other lines when they're created in Merge Drawing mode. When you draw merge-shape lines over merge-shape fills, you can wind up with lots of little segments. Try drawing lines with the pencil tool and shapes with the brush tool set to Merge Drawing mode. If you paint a brush stroke that intersects a line, the brush stroke remains one solid object, but the line gets segmented (Figure 5.2). If you draw a line that intersects a brush stroke, the line cuts the brush stroke, and the invisible outline of the brush stroke cuts the line (Figure 5.3).

Figure 5.2. When a merge-shape fill overlays a merge-shape line, the fill segments the line. As the selection highlighting shows, the fill remains one solid object.


Figure 5.3. When a merge-shape line overlays a merge-shape fill, the line cuts the fill, and the fill's invisible outline cuts the line.


When Merge-Shape Fills Intersect

When intersecting fills created in Merge Drawing mode are the same color, the newer fill adds to the merge-shape (Figure 5.4).

Figure 5.4. When you draw overlapping fills in the same color in Merge Drawing mode, Flash puts the two shapes together to create a single merge-shape.


When fills of different colors interact, the newer fill replaces the older one (Figure 5.5). If the new fill only intersects the old, it still replaces the part where the two overlap.

Figure 5.5. When one merge-shape fill overlaps another of a different color, the fills don't meld but remain separate. The second oval here replaces the first where they overlap.






Macromedia Flash 8 for Windows & Macintosh Visual QuickStart Guide
Macromedia Flash 8 for Windows & Macintosh
ISBN: 0321349636
EAN: 2147483647
Year: 2005
Pages: 204

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