Recipe 3.16. Grouping Elements


Problem

You want to bind together a collection of elements as a group; or, you want to prevent drawn lines and shapes from cropping, unioning, and punching one another.

Solution

Choose Modify Group, or convert the collection of elements into a symbol.

Discussion

You can group a collection of entities into a single item, by choosing Modify Group. When grouped, you can no longer edit the elements individually. For example, when grouped, you cannot directly edit text, change a fill, or reshape a line.

To modify an individual element within a group, you have to edit the group. To do so, double-click the group. The group opens, and you can modify the group, in a mode akin to symbol editing mode. When you are finished, you can return to the main stage by choosing Edit Edit All.

Grouping is impermanent; you can ungroup a group at any time by selecting Modify Ungroup. You can also nest groups. To do so, select an existing group and any other element, and choose Modify Group. The original group is preserved within the new group, as a nested group.

Though grouping can be a convenient feature, especially when drawing complex art, it has no architectural benefit. In contrast, you can use graphic, button, or movie clip symbols as a way of grouping elements, and when you do, you realize all the benefits of using symbols. For example, if you group a collection of items as any type of symbol, you can apply motion tweens to it. If you group a collection of items as a movie clip, you can apply scripts to it, and so on. In short, use grouping as a temporary way to lock several items together while you work, but use symbols to make these collections more functional at runtime. Another benefit of using symbols over groups is that you can reuse them and achieve file size savings.

See Also

Recipe 3.15




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