Using Vector and Bitmap Graphics

Figure 2.2. A vector drawing is on the left, and a bitmap image is to the right. Notice the difference in edges, clarity, and the potential for detail.

Figure 2.3. Trace a bitmap image to turn it into vectors.

Performance and Vectors
Although it is primarily a cosmetic choice when you choose between using vectors and bitmaps, you might also consider the performance and scalability between the two forms of graphics when choosing to animate them. You should always change any vector drawings that you make directly on the Stage (which is raw data) into symbols before publishing the FLA. Vectors that are raw data have a crosshatch pattern over them when they are selected. Raw data placed on the Stage has to be rendered out (drawn on the Stage using calculations when the SWF file plays) every time the playhead reaches that frame on the Timeline because the information is not stored in the Library. By changing the raw data into a symbol, you can reduce the SWF file size so the information has to be referenced only once in the Library instead of many times individually on the Timeline. It also makes the graphic easier to select on the Stage. However, you can shape only tween raw vector graphics, and certain other elements (such as motion guide paths) must be raw vectors as well.
Exercise 1: Importing graphics
The first step of creating the animation is to import the graphics to animate. These graphics were created for you already: The graphics for this project were drawn by hand in Photoshop using a graphics tablet (this could have just as easily been accomplished using Fireworks). Each graphic was created on separate layers and then exported as PNG files with transparency. Feel free to replace these graphics with your own. You can draw your own graphics, or you might even manipulate several photographs and use them instead.

1. Select File > New; then select Flash Document and click OK to create a new FLA file. Then select File > Save As to save the file, and type panning.fla into the File name (Windows) or Save As (Mac) text field. Click OK to save the document.2. Locate the 02/start/images folder on your hard drive. If you have not transferred the contents from the CD-ROM to your hard drive, copy over the 02 folder first before you import the PNG graphics for this exercise.3. Select File > Import > Import to Library from the main menu. Select all the PNG files in the 02/start/images folder. To select all of the files simultaneously, hold down the Shift key while you click each file to select the entire directory, or select one file and hold Shift while you press your arrow keys. Click Open (Windows) or Import to Library (Macintosh) to import the files into the FLA document.All the PNG files are now stored in the Library. Open the Library (Window > Library) to see that all seven PNG files imported successfully.4. Select the Stage and open the Property inspector (Window > Properties) to change the dimensions and color of the Stage. Click the button next to Size to open the Document Properties dialog box. Change the dimensions of the Stage to 500 (width) by 400 (height). Then click the Background color control, and type #99CCFF into the text field at the top of the color pop-up menu, as shown in the following figure. This hexadecimal color specifies a light blue color for the background.
Figure 2.4. Specify a background color and dimensions for the Stage using the Document Properties dialog box.


Figure 2.5. Your layers should be named the following (from top to bottom): clouds, grass, sun, bird, mountains.

Chapter 2. However, each subsequent chapter uses shortcut keys only.In the next exercise, you will create movie clips that include each of the images you just imported.
Exercise 2: Creating movie clips
This exercise creates movie clips from each of the images that you imported. The three parts of the bird image (body, wing, and leg) are each converted into movie clips, and then the wing and leg are nested inside the body movie clip. You do this so the bird as a whole can be tweened, and then you can tween the wing and leg individually as well.
1. Open the Library in panning.fla, and drag the following PNG files to the following layers:clouds.png to the clouds layergrass.png to the grass layersun.png to the sun layerbird-body.png to the bird layermountains.png to the mountains layer
The order of these layers is important because the layering adds a sense of depth. The mountains must be on the lowest layer because they are farthest in the background. The grass must be on the top layer because it is the closest to the viewer and creates the foreground.2. Select each PNG image that you added to the Stage, and select Modify > Convert to Symbol (or press F8) to convert them into movie clips. Name each movie clip the same name as the PNG file (remove the .png extension). When you finish, you should have one movie clip on each layer.

Figure 2.6. Drag the PNG files onto their own layers so you can convert them into movie clips.


Figure 2.7. Align all the movie clips so they form a layout that you can tween.
