- Selecting Artwork
- Adjusting Elements
- Mastering Flash Curves
- Working with Cubic Paths in a Quadratic World
- Erasing Fills and Contours
- Troubleshooting Artwork
- Did You Know?

## Working with Cubic Paths in a Quadratic World

This problem begins with Pierre Bézier, who developed a method for creating
curves in the late 1960s while he was working for Renault SA (the French carmaker).
He decided that a curve could be fairly accurately defined as two end points
(called *anchors*) and two other points off the curve (called *handles*).
Figure 3.10 shows
these four points; notice that a line can be drawn from each anchor point and
a handle.

The resulting curve must follow some rules. It must start at one of the end
points, race off with a slope equal to the slope of the adjacent segment (which,
by the way, is actually a tangent to the curve at that point), and then come
home on the second anchor point, approaching with the slope of the second
segment (another tangent). This typical configuration is called a Bézier
curve of the third order, or a *cubic Bézier*. The name derives from
the cubic equation used to very precisely define curves: y = Ax^{3} +
Bx^{2} + Cx + D.

This cubic curve is very precise. With the cubic Bézier, you can draw a quarter of a circle (a 90° arc) to within 0.06% accuracy—pretty darn close to being right on.

**Figure 3.10 This
is the difference between a cubic curve (left) with two control points and a
quadratic curve (right) with one control point.**

One of the new introductions in Flash 5 is a Bézier Pen tool (you'll find this in almost all other design programs, too). This enables you to designate two anchor points and then use the handle points to help shape the curve.

But there is a problem. The Bézier Pen is not exactly what it appears to be. Yes, you can draw cubic Bézier curves in editing mode, but when you compile the movie, the resulting SWF file does not actually use a cubic representation to define the curve. Instead, it is converted from cubic to quadratic.

Quadratic Bézier curves have only one control handle for each segment
instead of two in the cubic curve. This can be defined as a quadratic equation:
y = Ax^{2} + Bx + C.

### Vector Methods Don't Mix

The reduced order (from two to one) of the curve means less data storage and faster rendering on the end platform—both advantages in the world of Flash. The entire issue would probably stop there, except for the fact that quadratic curves also are less accurate compared to their cubic cousins. The quadratic curve is only an approximation of the cubic one and technically has far less chance of being totally accurate.

That fact makes Macromedia's application of quadratic vectors something of a kludge in certain sectors—particularly in the graphic design community, where the accuracy of a PostScript letter can be the most important issue of the week.

The resulting drop in accuracy can cause subtle changes in imported artwork. For example, Adobe Illustrator's AI format uses cubic Bézier representation, but it is converted to the Flash quadratic Bézier curves on output. The cubic Bézier points will be there for editing, but not in the final output.

You might run into problems importing PostScript files, such as Adobe Streamline, into Flash. The original shape might render a quadratic Bézier with more points than necessary. Use the curve Smooth or Optimize tool to reduce the impact it has on file size.

### The Importance of Using the Subselect Tool

Recall that the Subselect tool is the white arrow tool. This minor change in the way Flash treats curves makes the Subselect tool a little more critical than you might originally have thought. Both the Bézier Pen and the Subselect tools can create or edit cubic representations of your quadratic Bézier curves.

When you have created a contour in Flash, you can edit it like a cubic Bézier by clicking the curve with the Subselect tool. Anchor points appear all along your curve, and you can make even the most imperceptible changes to each section.

#### Adjusting Anchor Points and Segments

All curves and line segments have anchor points and handle points to adjust their paths. When two lines are joined, they form a corner.

You can highlight the anchor points with the Subselect tool. They appear as individual squares connected by a line. When you click a single point, it turns into a hollow circle with two extending handle points represented by filled circles (see Figure 3.11).

To move an anchor point, simply drag it with the Subselect tool. You can move multiple points by selecting them and then using arrow keys on the keyboard to nudge them back and forth.

Anchor points also can be either curve points or corner points. To convert a corner point into a curve point, hold down the Alt key in Windows or the Option key on the Mac and then select it with the Subselect tool. If you want to convert a curve point to a corner point, just click it with the Pen tool.

**Figure 3.11 Cubic
control points are available on every curve. Highlight them using the Subselect
tool.**

In some cases, you might want to add an anchor point to a line segment. Click anywhere on the segment with the Pen tool, and additional squares—indicating the new anchor points—will appear. It also is important to clean up unnecessary anchor points. To remove a corner point, click it with the Pen tool, and to get rid of a curve point, double-click it with the Pen tool. You also can use the Subselect tool to highlight any point on your lines and just press the Delete key. As you hold the Pen tool over these points, various icons appear, indicating the available options. If you are holding the Pen tool over a curve point, a small V appears next to the Pen icon, indicating you can convert the point to a corner with one click. If the point already is a corner, a small minus sign appears, indicating one click will remove the point altogether.

In the end, there is no limit to how many four-point cubic Bézier points you can apply to a curve, because they won't compile in the final SWF file. But the total number of three-point quadratic Bézier curves does matter. Even though a number of your reference points are being eliminated, if you try to overcompensate by breaking your artwork into very tiny curves, the final results most likely will be less than noteworthy.

Ultimately, most developers understand that the trade-off here simply is final performance. Smaller curve segments certainly make the final artwork more beautiful, but complex outlines and bitmaps—complexity in general—reduce the performance of your Flash movie.

**CAUTION**

More curves mean more complexity and therefore a larger file size. You might need to optimize your shapes to limit the complexity and improve output performance.

#### Quadratic to Cubic and Back Again

These cubic Bézier representations are stored in the FLA file when you return to the file. You might, however, find that occasionally your cubic Bézier has undergone a sort of reeducation on the total points in the curve.

For example, if you are drawing with the Bézier Pen tool or editing with the Subselect tool, executing an Undo command might actually generate more points on the curve than existed before the Undo. This is because complex curves can be represented by many more simple curves.

In other cases, moving a shape with the regular Arrow tool can also generate additional control points because of the way the transform is executed.

You might find similar problems when you bring your Illustrator files into a Flash movie. These files can wind up with a massive number of cubic representations. In that case, you probably should run the Modify, Optimize command from the main menu to remove some of the unnecessary points.

Flash's introduction of faux cubic Béziers also can work to your advantage. Because the program is so good at compiling and creating them, it can quickly reinterpret changes you make to a shape with new Bézier reference points. So if, for example, you chop a curve in two, Flash scrambles quickly and, with the Subselect tool, lets you use new anchor and control points.

And these same controls are available for other curves you might create with Flash brushes. Even though you can manually grab and twist these lines with the main Arrow tool, you also can call up a battery of Bézier controls with the Subselect tool.

But remember, in the end, it's all an illusion. At compile or publish time, the SWF discards your cubics for quadratic interpretations, and the end result might not be exactly what you expect.