# Recipe 1.10. Drawing Primitive Shapes

### Recipe 1.10. Drawing Primitive Shapes

#### Problem

You want to draw primitive shapes, such as ovals, circles, rectangles, and squares.

#### Solution

Use the Oval (O) and Rectangle (R) tools, or the Pencil (Y) tool.

#### Discussion

To create ovals or rectangles, select the Oval or Rectangle tool from the Tools panel, and click and drag across the stage to create the bounds of the shape. Because they are closed shapes, ovals and rectangles are automatically filled with the default fill style.

 Fills are not visible if View Outlines mode is active. To view fills, switch to another mode, such as View Antialias.

Set the fill style to No Color to create unfilled shapes. To create an unfilled shape regardless of the default fill style, use the Pencil tool to scribble your best approximation of a rectangle or oval. Flash will automatically convert a rough approximation to a perfect rectangle or oval, especially if the Recognize Shapes optionunder Edit Preferences Drawingis set to Tolerant. The Recognize Shapes option works only if you draw the shape in one continuous motion without releasing the mouse button or lifting the pen from the tablet until youve closed the shape. Also note that the only shapes that Flash can recognize with the Pencil tool are primitive shapesovals, rectangles, and triangles . It cannot recognize polygons with sides numbering anything greater than four. To draw regular polygons ( polygons with equilateral sides) you'll need to use the PolyStar tool as discussed in Recipe 1.11.

In Flash's drawing paradigm, a shape is created with a series of points, not treated as a separate primitive object (the Oval and Rectangle tools create shapes with at least four points).Selecting any point along the curve, by using the Subselection tool (A), allows you to distort the original shape.

To create a perfect circle or square with the Oval or Rectangle tool, use shift-con-straint; that is, hold down the Shift key as you drag.

When using the Rectangle tool, you have the option of drawing a rectangle with rounded corners. You can set the corner radius in the Options section of the Tools panel by clicking the Set Corner Radius icon. In the dialog box that displays, specify the radius in pixels.

Recipe 1.4

### Recipe 1.11. Drawing Regular Polygons

#### Problem

You want to draw a polygon (a closed shape made of straight lines, such as a triangle, hexagon, etc.) that has sides of equal length.

#### Solution

Use the PolyStar tool.

#### Discussion

The PolyStar tool allows you to quickly draw regular polygons with up to 32 sides. You can find the PolyStar tool nested with the Rectangle tool. There is no keyboard shortcut to the tool, so the only way to get to it is to select it from the Tools panel. Because the PolyStar tool is nested with the Rectangle tool, only one is visible at a time. Therefore, if the Rectangle tool is currently visible, click and hold the mouse on the Rectangle tool to display the pop-up menu from which you can choose the PolyStar tool. You'll know when the PolyStar tool is selected, because the icon on the Tools panel will appear as a regular hexagon instead of a rectangle.

After you've selected the PolyStar tool, you next need to select the correct options before drawing. Because the PolyStar tool allows you to draw many different types of polygons (as well as stars), you need to make the appropriate selections from the tool settings. You can access the tool settings via the Options button in the Property inspector. Clicking the Options button will open a dialog box from which you can select the number of sides. In order to draw a polygon, make sure the style is set to Polygon and not Star. The star point size applies only when drawing stars. After you've made the appropriate selections, you can click on the OK button to close the dialog box.

With the settings made, you can draw a regular polygon by clicking on the stage and dragging the mouse or stylus to the size of polygon you want. If you hold the Shift key while drawing the polygon, Flash will snap the shape to 45° increments .