Home > Articles > Graphics & Web Design > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Importing Vector Graphics

There may be times when you have an existing vector graphic that needs to be included in your Flash movie. Typically, such a vector graphic is likely to be geometric—although not necessarily. Regardless of the exact form of the vector graphic, unless it's super complicated, you'll be able to import it into Flash.

From File

One way to incorporate other graphics into Flash is to import them from a file. It's as simple as selecting File, Import and pointing to the file you want, as shown in Figure 3.1. You will see several file types listed, but that doesn't mean they all work equally well. Not only are several image file formats listed (both raster and vector), but video and audio file formats also appear. Let's first look at the vector image formats available for import.

Although many file types are listed in the Import dialog box, only four vector formats are worth considering: FreeHand (.FH10 through .FH7), Illustrator (.ai), Illustrator EPS, and Flash Player (.swf). Generally, the best option is FreeHand. The only Illustrator versions supported are 3.0 through 6.0 and version 8.0. Artists working in Illustrator versions newer than 8 (which is very likely, as 8 is pretty old) can simply save a copy and select version 8 or lower (but not 7.0—don't ask me why). Unfortunately, this occasionally means that certain visual elements are lost. The most important concern is that the artist always retain a copy of the source file matching the version of Illustrator he uses. Because of this limit, when using Illustrator you'll see the best results if you export a .swf (Flash) file from Illustrator. (Some older versions of Illustrator require that you download and install Macromedia's free "Flash Writer" plug-in in order to export .swfs.) We'll discuss how this choice affects importing in the later section "Importing Flash Player Files."

Figure 3.1 Importing images (or audio) is as simple as selecting the file you want to import.

If all you have is an .ai file, you could try importing it into Flash. It will be painfully obvious if it doesn't work properly. The image will look nothing like what you expect, as you can see in Figure 3.2. This indicates that the .ai file was saved in a version number greater than 6, and Flash can't interpret the file. You must open the file in Illustrator (a new version) and then either save as version 6 or export a .swf instead.

Figure 3.2 Upon importing an unsupported file format (in this case a version 9.0 Illustrator file), you'll often see an error dialog box like one of these.

Importing FreeHand Files

Flash can seamlessly import FreeHand source files. If you're familiar with FreeHand, this is probably the best way to import vector art into Flash. It's simply a matter of selecting File, Import in Flash and selecting a FreeHand file to import. You'll be presented with the FreeHand Import dialog box, as shown in Figure 3.3.

Figure 3.3 After importing a FreeHand file, Flash provides this dialog box.

Several options are available when you import FreeHand documents into Flash. The Mapping choices let you specify how Flash deals with features unique to FreeHand. For example, if your FreeHand file has "pages," Flash needs to know how it should handle them. All the options are fairly easy to interpret and are selected upon import into Flash. But you can do a few things (ahead of time) while in FreeHand to make the import smooth.

Here are some tips to help your drawings import into Flash. First, you should take advantage of FreeHand's symbols because these will translate directly to Flash's symbols so that graphics can be recycled. We'll discuss symbols and Flash's Library in Hour 5, "Using the Library for Productivity." Also, each object created in FreeHand should be separated into its own layer. Although you can easily put multiple objects on one layer, the file will import better if you create multiple layers.

There are many text effects that you can do in FreeHand that won't translate to Flash. For example, text attached to paths won't remain editable once in Flash. Also, because only FreeHand supports strokes on text, this effect will be ignored by Flash. Fine adjustments to font sizes (and kerning) are possible in FreeHand (but not as well in Flash), so font spacing often changes slightly once inside Flash. Sometimes text from FreeHand will automatically convert to paths (which means it won't be editable once inside Flash). I discuss converting to outlines as a solution to some text problems in the section "Steps to Maintain Image Integrity" because it can resolve some of these issues. These are just some general tips. Creating the smallest, best-looking image that imports seamlessly into Flash might take some additional experimenting in FreeHand.

Importing EPS Files

Another vector format supported is Encapsulated PostScript (EPS). Unfortunately, many variations of this file format exist, such as Photoshop EPS, but the only one Flash supports is Illustrator EPS. The best way to find out whether your file works is to test it and see. Not only will your images look wrong if it's not working, but you'll likely see the dialog box similar to those in Figure 3.3 above.

Of all the options that work, importing EPSs is the worst because it doesn't work reliably. It might work properly under one set of circumstances and then fail to work for another situation. If your testing involves truly representative samples, you'll be fine—but that's easier said than done.

Importing Flash Player Files

Finally, the most reliable option for importing vector graphics into Flash (besides, possibly, simply importing native FreeHand files) is to import Flash Player files (.swf). Most graphics people don't think of .swf as a file format, but it's certainly a standard. Of course, an .swf is not like a FreeHand or Illustrator file because it's not fully editable. As of FreeHand 9 and Illustrator 9 (Illustrator 8 requires the free Macromedia "Flash Writer" plug-in), you can export your working files into the .swf format. They export amazingly well. The proof can be seen in two measures: The final files are smaller, and the image retains all the details and quality of the original.

The best process is to create a graphic in whatever program you prefer, and then open it in a program that exports .swfs and simply export it as an .swf. You can then import it directly into your movie. Even if the graphics program you use doesn't support exporting .swfs, open the file in a tool that does and export an .swf from there. This means that the graphics tool you select must export files in a format that is supported by the tool you use to export .swfs.

If you have trouble with the process of exporting .swfs from the graphics program and importing into Flash, you can try several remedies. First, investigate the export options in the graphics program. In Figure 3.4, you can see dialog boxes that appear when exporting .swfs. Without explaining each option, you should notice similarities among all three. Experimenting with these options is a good place to start.

In addition to the export to .swf options, there are a few specific techniques you can try (covered in the section "Steps to Maintain Image Integrity," later in this hour). Ultimately, however, the solution sometimes involves making the graphic simpler—that is, reducing its complexity.

From Other Programs

The following technique works, but not very well. I mention it because it usually works well for simple graphics, and it's very quick. You simply open your graphics file in any graphics creation tool while Flash is open. Select and copy the contents (or some of the contents), effectively putting that image in your Clipboard. Go to the open Flash file and paste.

Figure 3.4 When exporting an .swf from FreeHand or Illustrator, you're given one of these dialogs.

If you do use this technique, you should open the Clipboard tab in Flash's Edit, Preferences dialog box (see Figure 3.5). From there you'll find several options in addition to the bitmap settings (namely, the gradient quality and editable text options).

Figure 3.5 Flash's Clipboard preferences provide an option to maintain FreeHand text formatting.

This sounds pretty simple compared to the previous section—but don't be fooled, it doesn't always work well. What actually happens is that the content of your Clipboard is converted to a particular file format. It varies as to what format, but it goes through a process similar to exporting an .eps then importing the .eps—it just happens automatically (and without your control). If it works, great. If not, go back to the other import options (exporting .swfs, .ai, or .eps), or better yet, draw it from scratch inside Flash.

Steps to Maintain Image Integrity

Despite how simple the export/import process may sound, it can be very frustrating when it doesn't work! Not to sound like a broken record, but the best way to maintain image quality is to create all your graphics inside Flash. For the times you must import an existing graphic or use a more advanced drawing tool, you can do several things to maintain image integrity. However, some of these tips are unnecessary when exporting .swfs from either Illustrator or FreeHand.

Font and text effects are usually the first things to go. Most drawing tools provide incredible font control, but Flash doesn't. The first consideration with text is whether the text must be editable within Flash. If you don't need to edit your text within Flash, you'll see the highest quality results if your text is first converted to paths. You'll find an option to do this automatically when exporting .swfs from FreeHand, and it doesn't affect the source FreeHand file—just the exported .swf. FreeHand's Convert to Paths feature is the same as Illustrator's Create Outlines and is equivalent to Flash's Break Apart option under the Modify menu. Of course, you'll never be able to edit the text after you do this, so you should save a backup first. In addition, this can tend to make your file size increase. We'll look at file size issues in much greater detail in Hour 20, "Optimizing Your Flash Site."

If you use gradients, you should definitely consider the Export .swf option. This is more important to keep the file size down and performance speed up (rather than simply retaining quality). A simple gradient, for example, will often include a separate circle for each step. Imagine hundreds of concentric circles, each varying only slightly in color and size. You can see this effect when you pick up and move an imported graphic with this characteristic, as in Figure 3.6. It's easy to see that such a gradient creates a larger file and one that plays more slowly—it's simply more complicated than it needs to be. When you export .swfs from Illustrator or FreeHand, the gradients are converted to Flash gradients. (Next hour you'll learn how to create and edit gradients inside Flash.)

Figure 3.6 Often an imported graphic is much bigger than it needs to be. This seemingly innocuous gradient is actually lots of individual concentric circles.

Going Back and Forth Between Flash and Other Vector Programs

Say you import a graphic created elsewhere, edit it in Flash, and then decide you need to touch it up again (in the original program). Doing so is not unreasonable or unexpected, but it doesn't work too well. Because it often fails to work, it's fair to question whether it's really necessary. Of course, if you just use Flash to create your graphics, this situation will be avoided—but the other drawing tool was probably chosen because it is more sophisticated. Because the other tool is so great, why not start over in that tool instead of trying to import the modified Flash graphic?

The best way to export an editable vector graphic from Flash is as an Adobe Illustrator .ai file. In the simplest case, you'll need to export just a still frame. For this, use Flash's File, Export Image menu and select Adobe Illustrator from the Save as Type drop-down list. This file can be opened in any drawing tool that supports .ai files (including Illustrator and FreeHand). No one can promise this will work without fail, but it seems to work better than other options.

If you just have a simple graphic, you can try the copy and paste technique. It usually works for simple graphics, although when you bring the graphic back to Flash, it will be different. For example, you might not be able to bend the line portions of a shape the way you could before it was taken to another program.

I've used a lot of techniques, and the only thing that is consistent is that you'll want to test several options until you find one that works well. The following summarizes the main points of this section:

  • Try to create all your graphics inside Flash.

  • If you use another program to create the graphics, try to refrain from making the file too complicated.

  • If you must import files from another vector program, the best method is to allow the other program to export an .swf file (which, in turn, can be easily imported into Flash).

  • A close second to the .swf option is to create your graphics in FreeHand and let Flash import the native FreeHand format. Although this might be the most convenient method, the files are not optimized automatically. So, you need to be familiar with FreeHand. The big advantage of this method is that image elements remain editable so you can make tweaks once inside Flash.

  • If you need to export from Flash to another program and then bring it back to Flash (which is really asking for trouble), the most reliable method is to select File, Export Image and make it an Illustrator .ai file.

  • Finally, you're always best off testing your options to carefully determine the impact on file size and performance, as we'll explore in depth in Hour 20.

  • + Share This
  • 🔖 Save To Your Account