Macromedia Flash8 Bible

After you've drawn some lines or shapes, you'll want to organize them in your layout. Flash provides some useful tools to help with moving or modifying elements that are familiar if you've worked in other graphics programs. Aside from using the Flash Grid and manually placed Guides with various snap settings to control your layout, you can quickly access the Align panel or the Info panel to dynamically change the placement of elements on the Stage. The Transform panel is the most accurate way to modify the size, aspect ratio, rotation, and even the vertical or horizontal "slant" of an element.

The precise alignment possible with panels and snapping controls is especially helpful if you're working with detailed artwork or multiple shapes that need to be arranged in exact relation to each other.

Simplifying Snapping Settings

There are five independent snapping settings in Flash. Snapping is a feature that gives you guidance when moving elements on the Stage and helps to align elements accurately in relation to each other, to the drawing grid, to guides, or to whole pixel axis points. The five different snapping controls can be turned on and off in the View ð Snapping submenu or in the new Edit Snapping dialog box (shown in Figure 5-42), launched by choosing View ð Snapping ð Edit Snapping (Ctrl+/ or z+/).

Figure 5-42: You can control Snapping settings in the new Edit Snapping dialog box.

You can tell that an item is snapping by the appearance of dotted guide lines, as shown in the Snap Align example (see Figure 5-43), or by the appearance of a small circle beside the Selection tool arrow cursor, as shown in the Snap to Object and Snap to Grid examples (see Figure 5-44 and Figure 5-45). For best control of snapping position, click and drag from the center point or from an outside edge of an element.

Figure 5-43: Snap Align guides give visual feedback for various alignment settings.

Figure 5-44: Snap to Objects indicated by a change in the size of the center point (or corner point) "o" icon as an item is moved to overlap with another item

Figure 5-45: The snap icon as it appears when an element is dragged onto a grid line with Snap to Grid turned on (snapping works regardless of whether the grid is visible or not)

The five main snapping modes are adjusted and applied as follows:

Snap Align

This feature gives you relative visual alignment guides as you move elements on the Stage. You'll either love or hate this option because it's the most "interactive" of all the snapping settings. The controls for Snap Align are in the Advanced settings of the Edit Snapping dialog box (shown in Figure 5-42). By default, Snap Align is set to display visual guides to alert you when an element is within 18 pixels of the Movie border (aka the Stage edge), or within 0 pixels of another element in your layout.

As you move an element around on the Stage you will see dotted lines (see Figure 5-43) that alert you when the edge of the element is exactly 18 pixels from the edge of the Stage, or 0 pixels from the next closest fixed element. The dotted guide lets you know when the edges of the two elements are touching (or perfectly aligned), either vertically or horizontally. Modify the Movie border settings to change the alert or alignment distance between elements and the edge of the Stage. Modify the Horizontal or Vertical Snap tolerance settings to change the alert distance between elements. If you also want to see guides when elements are aligned to the center point of other elements, select the Horizontal or Vertical Center alignment check boxes.

Tip 

If you change the Horizontal or Vertical Snap Align settings to show a dotted line when an item is a specific distance from another item (such as 10 pixels — this was the default setting in Flash MX 2004), you will still see the dotted line show up when the items are touching or within 0 pixels of each other. The fixed-distance Snap Align cue can be very helpful if you are trying to arrange items but you need them to be more than 0 pixels apart.

Snap to Objects

The Snap to Objects setting is a toggle that causes items being drawn or moved onscreen to snap to or align with other items on the Stage. Click the magnet icon in the Tools panel to turn snapping on or off (Shift+Ctrl+/ or Shift+z+/), or choose View ð Snapping ð Snap to Objects (a check mark is displayed next to the command if it's on). To control the tolerance of the magnet or the "stickiness" of the snap, use the Connect Lines setting found in Edit ð Preferences ð Drawing (or in OS X, Flash ð Preferences ð Drawing). By default, the Connect Lines tolerance is set at Normal. To make the magnet stronger, change the tolerance to Can be distant; to make it less strong, use Must be close. The Connect Lines control will help you to connect lines cleanly when drawing shapes or outlines.

As shown in Figure 5-44, Object snapping is indicated by the "o" icon near the center point as an item is moved from its original position (left). When the item is dragged close enough to another item to snap to it, the "o" icon gets slightly larger, which indicates to you to release the mouse (right). This same visual cue will work if you drag an item by a corner point rather than from a center point. Ovals can be aligned to the center point or to any point along their outer edge.

Snap to Grid

snap to Grid (Ctrl+Shift+' [apostrophe] or z+Shift+' [apostrophe]) is an option available under View ð Snapping ð Snap to Grid, which will help to align elements to guides or to the background grid. If Snap to Grid is turned on, elements show the snap icon by the Arrow cursor when you drag them close to a line in your grid, whether the grid is visible or not.

To control the tolerance of this snapping feature, use the settings found under View ð Grid ð Edit Grid (Ctrl+Alt+G or z+Option+G). The Grid Settings dialog box also includes check boxes for Snap to Grid and View Grid — these just give you another way to turn these tools on or off. Adjust the default horizontal and vertical spacing of the grid lines by entering new pixel values in the text fields. The first three settings in the Snap Accuracy menu are the same as those for Snap to Object, but there is an additional setting, Always Snap, which constrains elements to the grid no matter where you drag them. Figure 5-45 shows the default 18-pixel gray grid as it displays when it's made visible (View ð Grid ð Show Grid) with the Stage view zoom at 400 percent.

Snap to Guides

As we described in the previous chapter, guides are vertical or horizontal visual alignment tools that can be dragged onto the Pasteboard or Stage when Rulers are visible: Choose View ð Rulers (Ctrl+Alt+Shift+R or z+Option+Shift+R). If Snap to Grid is turned on when you drag guides out, they will be constrained to the grid; otherwise you will be able to place guides anywhere. After guides are set, they will be visible even if you turn Rulers off; to toggle guide visibility use View ð Guides ð Show Guides (Ctrl+; [semicolon] or z+; [semicolon]). As shown in Figure 5-46, Snap to Guides enables you to align an element to a guide, even if it is not aligned with the grid.

Figure 5-46: The snap icon as it appears when an element is dragged onto a guide with Snap to Guides turned on

Note 

Snap to Guides is independent of Snap to Grid, but guides can be placed only outside the grid when Snap to Grid is turned off.

Tip 

Rulers have to be visible to drag a guide onto the Stage, but after guides are placed, rulers can be turned off and guides will still be visible.

Snap to Pixels

Snap to Pixels is the only "global" setting that causes all elements to align with a one-pixel grid that is only visible when the View scale is set to 400 percent or greater. This setting does not necessarily help you to align elements with each other, but it does help to keep elements from being placed "between pixels" by constraining movement of elements on the X and Y axes to whole pixels, rather than allowing decimals. There is no shortcut key for turning Snap to Pixels on, but you can always toggle it on and off from the View menu by checking or unchecking View ð Snapping ð Snap to Pixel. Figure 5-47 shows how the pixel grid displays when the View scale is at 400 percent. Items are constrained to whole pixel axis points if they are dragged from the center or from an outside edge.

Figure 5-47: The pixel grid visible when View scale is at 400 percent or higher with Snap to Pixels turned on

Caution 

If an item is positioned between pixels — for example if the X, Y position is 125.5, 200.5 — the Snap to Pixel feature will not correct the position to a whole pixel value. Snap to Pixels only constrains the movement of items to whole pixel values. Thus, the item example given here could only be dragged to a new location by moving in whole pixel values; so it might end up at a new location such as 130.5, 225.5. If you want to keep items aligned to whole pixel values, use the input fields in the Property inspector to manually enter a starting location with whole pixel X, Y values — then use the Snap to Pixel option to keep items aligned with the one pixel grid.

Tip 

When you are working with an oval or other nonsquare polygon, you will notice that the X, Y values in the Property inspector may still show decimal pixel values even when Snap to Pixels is turned on. If you use the Info panel to change the shape's registration point from the default top-left setting to the center (click the center square in the Registration grid), you will have more success positioning and tracking the shape with whole pixel values.

Design Panels

When you are drawing in Flash, the design panels — Align, Info, and Transform — can be your best friends. Use the Align panel to align, regularize (match the sizes of), or distribute several items on Stage, either relative to each other or to the Stage area. Use the Info panel to modify the coordinates and dimensions of an item. Or use the Transform panel to scale, rotate, and skew an item.

In Flash 8, the Align panel (Ctrl+K or z+K), the Info panel (Ctrl+I or z+I), and the Transform panel (Ctrl+T or z+T) are grouped into a tabbed panel by default that will launch when you select any of the individual panels from the Window menu. It is handy to have these panels in a tabbed group, but if you prefer to work with them as single floating panels, use the Group…with ð New panel group command to separate the panels.

The Align Panel

The Align panel (Ctrl+K or z+K), shown in Figure 5-48, is one of many features for which you'll be grateful every time you use it. It enables you, with pixel-perfect precision, to align or distribute items relative to each other or to the Stage.

Figure 5-48: Use the Align panel to both size and arrange items with ease.

The Align panel has five controls. The icons on the buttons show visually how selected items can be arranged:

To align an item to the exact center of the Stage, do the following:

  1. Click to select the item that you want to center.

  2. Click the To Stage toggle in the Align panel.

  3. Click the Align horizontal center button.

  4. Click the Align vertical center button.

The Info Panel

Use the Info panel (Ctrl+I or z+I), shown in Figure 5-49, to give precise coordinates and dimensions to your items. Type the values in the fields provided, and by default your item will be transformed relative to its top-left corner.

Figure 5-49: Use the Info panel options to change the location and appearance of an item.

Caution 

The registration point set in the Registration grid is actually a global setting that "sticks" even after you close the panel and change tools. Once you change the registration point from top-left to center, any new shapes or symbols that you create will automatically have a center registration point. In most cases, it is best to stick with the default top-left registration point because this is the standard for items that are loaded or positioned with ActionScript. Changing the registration point on one item back to top-left will not have any effect on other items that were created with a center registration point.

The Info panel has these controls:

To scale or reposition an item, select the item and then open the Info panel with shortcut keys or by choosing Window ð Info:

The Transform Panel

The Transform panel (Ctrl+T or z+T) gives you precise control over scaling, rotating, and skewing an item. With this panel, instead of making adjustments "by eye" — that may be imprecise — you enter numeric values in the appropriate fields and apply them directly to the selected item. As shown in Figure 5-50, the value fields in the Transform panel make it easy to modify the size and position of an element. However, once transformations are applied to an ungrouped shape or line, these numbers reset when the shape is deselected.

Figure 5-50: Use the Transform panel to scale, rotate, and skew items.

Tip 

If you're using the Property inspector to resize an item by pixel values, you'll appreciate the constrain option. When an item is selected on the Stage, a small lock icon appears beside the Width and Height fields in the Property inspector. Click the lock to preserve the aspect ratio of an element as you enter a new value for width or height.

Some other powerful transform options are available from the Tools panel and from the Transform submenu of the Modify menu. We explain these more-complex editing tools in Chapter 9, "Modifying Graphics." However, the best place to start with transform options is the Transform panel, and these options are applied as follows:

The Edit Menu

We discuss many of the commands in the Edit menu in Chapter 4, "Interface Fundamentals," but some of these commands can be helpful for creating or modifying graphics and are worth mentioning again here:

Категории