Manipulating Graphic Elements

Flash gives you a gazillion tools to modify the drawings that make up your animations. You can stack, rearrange, and reposition each individual graphic element, transform (shrink and squish) them, move them, apply color effects, and more until you're completely satisfied with the way they look. It's a cliché, but it's true: When it comes to drawing in Flash, you're pretty much limited only by your imagination. This section acquaints you with the most powerful tools Flash has for modifying the lines, shapes, bitmaps, symbols, and other graphic elements you add to your drawings.

Flash's Properties panel is a beautiful thing. Select any element on the stage, and the Properties panel responds by displaying all the characteristics, or properties, that you can change about that element.

In Figure 5-15, for example, you see several graphic elements on the stage: a brush-drawn squiggle (fill), a bitmap of a frog, a line of text, and a star. When you select the star, the Properties panel shows all the properties associated with the star: the color, width, and type of outline; the fill color; and so on. When you select the text, the Properties panel changes to reflect only text properties.

Select a shape, and you can change the properties for the fill and stroke. If it's a merge mode graphic, you can select the fill and stroke independently. If it's an object mode graphic, the fill and stroke are both selected with a single click. In either case, the properties for the selection appear in the Properties panel. For example you can change the color, the thickness, and the style of a stroke. Select the fill, and you can change the color, the opacity (alpha), or the gradient. These color options are explained on pages Advanced Color and Fills and Inserting and Deleting Keyframes and Frames.

After you have an object on the stage, you can move it around, cut it (delete it), paste it somewhere else, or make copies of it.

To move an object, simply select it (Selecting Objects on the Stage), and then drag it around the stage. Figure 5-16 shows an example of using the Selection tool to select a group of objects, and then move them together.

In the graphics world, transforming an object doesn't just mean changing the object; transforming means applying very specific shape and size changes to the object. These changes—called transforms—include some fun tricks:

You have several choices when it comes to applying a transform to a selected object (or group of objects):

To rotate a drawn object around its axis, first select the object on the stage, and then proceed as follows:

Until Flash CS4 came along, it wasn't easy to make an object look as if it were moving in three dimensions. For example, if you wanted to make an image look like as if it were traveling away from the viewer, about all you could do was move it slightly on the stage and make it smaller. There was no real science to the effect; the best you could do was eyeball it. Creating a 3-D rotation effect was even more difficult. But no more. Flash now has tools that automatically create exactly these two effects. Next to the selection tools, there's another tool that looks like a globe with some circles drawn around it, shown in Figure 5-24. Press and hold that button, and you find the two tools that turn the stage into a 3-D world. The globe lets you rotate an object three-dimensionally, while the tool with three arrows lets you move an object around in 3-D space.

One catch is that the object has to be a movie clip or a TLF text field. (For details on text fields, see Copying Color with the Eyedropper). This isn't too much of a catch, because you can put any object inside a movie clip—like your logo or some text—and then make it fly and spin in 3-D. The other catch is a bit more limiting, since Flash's drawing tools create only two-dimensional images. For example, you can create squares but not cubes, and circles but not spheres. The text tool creates only two-dimensional type, not 3-D letters. But once these objects are placed inside movie clips, you can move those movie clips around in three dimensions. It's sort of like moving a photo of a car around in 3-D space as opposed to moving a model car around the same space. But even with those limitations, you can create some pretty snazzy effects.

Note

Because the 3-D tools are a relative newcomer to Flash, they won't work if you choose the ActionScript 2.0 option (see Starting Flash) and they rely on Flash Player 10 or greater—an option you choose when you publish your animation (8. Group elements).

The 3-D pros refer to rotating an object as transforming an object or a transformation. Here are the steps for rotating a movie clip in 3-D:

  1. Select the object or group of objects you want to spin, and then press F8 to convert them into a movie clip symbol.

    You can combine objects in a movie clip. For example, Figure 5-25 shows a circle and text combined in one movie clip.

  2. On the stage, select the movie clip, and then click the 3-D Rotation tool in the Tools palette.

    A globe-like image appears near the movie clip, made up of colored circles. Each color represents a 3-D axis. The small circle in the center marks the point around which the rotation happens.

  3. Drag the center point to change the point around which the rotation takes place.

    You can drag the center point to any location on the stage or even off the stage.

  4. Click one of the colored lines in the 3-D rotation tool to rotate the movie clip along that axis.

    As you hold the cursor over one of the colored axes, a tooltip appears indicating the axis around which the object will rotate. For example, move the cursor near the green line and a Y appears on the cursor, meaning that the selected object will rotate around the Y axis. You can think of the Y axis as a line that runs from the top of the stage to the bottom. The red line in the sphere represents the X axis, and the blue circle represents the Z axis, which you can think of as a line running from the viewer back into the stage. The easiest way to get your bearings is to experiment. Try the different options and click Undo (Ctrl+Z or ⌘-Z) if you don't like the results. If you don't want to be limited to spinning along a standard XYZ axis, then drag the orange ring around the outside of the other circles. That way, the object is free to follow your mouse movement in any direction.

The 3-D pros refer to moving an object in three dimensions as translating an object or a translation. Here are the steps for moving a movie clip in 3-D:

  1. On the stage, select the movie clip you want to move in 3-D.

    Make sure the object you want to move is a movie clip symbol. If not, press F8 to make it into one.

  2. In the Tools palette, click and hold the button for 3-D rotation tools, and then choose the 3D Translation tool from the menu.

    In the tools panel, the 3D Translation Tool looks like three arrows pointing in different directions. After you click the button, a 3-D translation icon appears over the selected movie clip on the stage. The 3D Translation icon looks like a red and green arrow protruding from a large dot. As shown in Figure 5-26, each arrow is a different color to represent an axis along which the movie clip can be moved. Green moves the object vertically (the Y axis). Red moves it horizontally (the X axis). The big represents the Z axis.

  3. Drag one of the colored arrowheads or the dot to move the movie clip along that axis.

    When you hold the cursor over one of the arrowheads or the dot, a tooltip appears indicating the direction of the axis: X, Y, or Z. In addition to using the 3D Translation tool, you can also use the Properties panel to move objects along the three axes (Figure 5-27). Select the movie clip you want to position, and then use the 3D Position and View X, Y, and Z settings to move it around the stage. Click a setting and type a number, or drag to scrub in a number.

In Chapter 4, you learned how to stack objects to create composite drawings using layers. But you don't need layers to place one item on top of another. You can overlap two or more objects on the same layer, but there are a few issues to consider:

The instant you create two or more overlapping object drawings on the stage, though, you need to think about stacking, or arranging them. Stacking tells Flash which object you want to appear in front of the other.

In Figure 5-29, for example, you see three object drawings: a rectangle, a circle, and a star. They were drawn in object mode in that order, so Flash stacks them one on top of the other with the rectangle first, then the circle on top of the rectangle, and the star at the top of the stack. Flash keeps track of the stacking order even if the shapes aren't overlapping one another. So, when you drag the rectangle and drop it on top of the star, Flash displays the rectangle behind the star. Then, when you drag the circle and drop it on top of both the rectangle and the star, Flash displays the circle behind the star, but in front of the rectangle, as shown in Figure 5-31. If that's the effect you want, great; if not, you can change the stacking order of all three shapes.

To stack objects on the stage:

Figure 5-31 shows you an example of choosing Bring Forward with the circle selected. There is a way to make shapes drawn in merge mode behave like object drawings when you stack them. The trick is to group them. Select the fill, stroke, and anything else you want to include in a group. Then choose Modify→Group (Ctrl+G or ⌘-G). The selected objects are now part of a group that you can position using commands like Bring Forward or Send to Back. For details, see the box on Safety in Groups.

As you saw in Chapter 2 (Choosing a Drawing Mode), Flash treats lines and fills differently when you're working in merge drawing mode. For example, take a look at Figure 5-32, which shows a line drawn with the Pencil and a line drawn with the Brush.

If you click the Selection tool and then click to select the Pencil-drawn line, Flash highlights just one segment of the line. But performing the very same operation on the similar-looking Brush-drawn line selects the entire line.

When you convert a line into a fill, Flash lets you interact with the line just as you would with any other fill. This technique is especially useful when you're working with shapes, no matter which drawing mode you're using. That's because when you create a shape using one of Flash's shape tools—a star, say, or a circle—Flash actually creates two separate elements: the inside of the shape (a fill), and the outline of the shape (a stroke). If you want to change the color of the entire shape, you need to use two tools: the Paint Bucket tool (which lets you change the color of fills), and the Ink Bottle tool (which lets you change the color of strokes, or add a stroke to an existing fill). When you convert the outline to a fill, Flash lets you manipulate both the outside and the inside of the shape in the same way using the same tools. Converting also lets you create scalable shapes (images that shrink evenly) and nice, straight corners (thick strokes appear rounded at the corners; thick fills shaped like lines don't).

To convert a line into a fill:

In Chapter 2 (Adding Measurement Guides), you saw how to use Flash's grid, guides, and rulers to help you eyeball the position of objects as you drag them around on the stage. You also saw how to use the Alignment panel to line up objects with respect to one another or to one of the edges of the stage.

Both these approaches are useful—but Flash doesn't stop there. Snapping and guide layers give you even more control over where you place your objects with respect to one another on the stage.

Snapping is one of those features people seem to love or hate. The key to snapping is to turn it on when you need consistent alignment and to turn it off when it cramps your style. Here's how it works: When you turn snapping on, you tell Flash to help you out when you're positioning objects on the stage. Snapping helps in a few ways. For one, it provides guidelines when elements are aligned. And it also makes items snap into place when they're close. You don't have to be a mouse marksman.

For example, in Figure 5-33, you see an oval being dragged across the stage. Because Snap Align is turned on, Flash displays a dashed line (top) when the circle is dragged so that one or more of its edges is aligned with another object in your animation. Snapping also creates a snapping point at the point clicked or, if you click close to the center of an object, in its center.

To turn on snapping, select View→Snapping, and then, from the shortcut menu that appears, choose one of the following:

If you've ever traced a drawing onto a piece of onionskin paper, you understand the usefulness of guide layers in Flash.

A guide layer is a special kind of layer that doesn't appear in your finished animation, but that you can hold beneath your stage while you're drawing to help you position and trace objects. Say, for example, you want to align objects in a perfect circle, or on a perfect diagonal, or you want to arrange them so that they match a specific background (say, an ocean scene). You create a guide layer and, on it, draw your circle or diagonal or ocean scene. Then, when you create your layer, your guide layer shows through so you can position your objects the way you want them. When you go to run your animation, though, you don't see your guide layer at all; it appears only when you're editing in Flash.

To create a guide layer:

  1. On the stage, draw your guide shapes or lines, or add a tracing image, as shown in Figure 5-35.

    This first layer contains the "guide" material. Later, you add one or more layers with the images you want to appear in your animation.

  2. Position your cursor over the name of the layer you want to turn into a guide layer, and then right-click.

    Flash displays a pop-up menu.

  3. From the pop-up menu, select Guide.

    Flash displays a little T-square just before the layer name, as in Figure 5-35.

  4. With the guide layer still selected, create a new, regular layer for your objects by choosing Insert→Timeline→Layer.

    Flash creates a new layer and places it above the guide layer, as shown in Figure 5-35.

  5. Select View→Snapping, and then, in the context menu that appears, turn on the checkbox next to Snap to Objects. You've turned snapping on.

    Turning snapping on helps you position your objects on your guide layer. Both Snap to Objects and Snap Align are helpful when you work with a guide layer.

  6. With the regular layer selected, draw, trace, or move your objects.

    You can then drag objects to your guideline (or guide object, or guide background) or use objects in the guide layer for tracing. When tracing a cutout, as in Figure 5-35, temporarily adjust the alpha (transparency) setting of objects you want to see through.