# Manipulating Artwork with Flash 5

• Print
This chapter is from the book

## 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 = Ax3 + Bx2 + 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 = Ax2 + 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.

• 🔖 Save To Your Account

### InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

## Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

## Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

### Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

### Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

### Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

### Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

### Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

### Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

## Other Collection and Use of Information

### Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

### Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

### Do Not Track

This site currently does not respond to Do Not Track signals.

## Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

## Children

This site is not directed to children under the age of 13.

## Marketing

Pearson may send or direct marketing communications to users, provided that

• Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
• Such marketing is consistent with applicable law and Pearson's legal obligations.
• Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
• Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

## Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

## Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

## Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

## Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

## Sharing and Disclosure

Pearson may disclose personal information, as follows:

• As required by law.
• With the consent of the individual (or their parent, if the individual is a minor)
• In response to a subpoena, court order or legal process, to the extent permitted or required by law
• To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
• In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
• To investigate or address actual or suspected fraud or other illegal activities
• To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
• To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
• To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.