Importing Graphics into Flash MX
In the last two hours, we've seen how you can create sophisticated custom graphics very quickly in Flash. Despite how powerful Flash's graphic creation tools are, eventually you may want to import graphics created elsewhere. Two good reasons are to use a photographic image or to use an existing graphic (instead of re-creating it from scratch). You can certainly use those other graphics in Flashand that's what we're going to learn how to do this hour.
Specifically, this hour you will:
-
Import vector graphics into Flash
-
Import bitmapped (raster) graphics
-
Learn ways to avoid imported graphics
-
Optimize and maintain the best quality possible when importing
Vector Versus Raster Graphics
Vector graphics have certain characteristics because of how they are stored by the computer. A vector graphic file contains the math to redraw the image onscreen. For example, a circle includes information such as the radius, the line thickness, and the color. All the graphics you create in Flash are vector based. Vector graphics have two advantages: The file size tends to remain small (therefore it downloads fast), and the image can be scaled to any size without any degradation to image quality (a circle's still a circle even if it's a large circle).
Vector graphics are great, but it's important to realize their disadvantages. Vector graphics require the user's computer to work harder to display the image (it has to do a lot of math), and vector graphics often look "computery" or antiseptic because they tend to involve geometric shapes. Both disadvantages can be overcome, but you should be aware of them.
Bitmapped (also called raster) graphics are fundamentally different from vector graphics. A raster graphic file contains the color information for each pixel. If the image is 100 pixels by 100 pixels, that's 10,000 pixels each with a color value. As a result, raster graphics are almost always relatively large files. Raster graphics also can't be scaled very effectively. They tend to get grainy, similar to a photograph that has been enlarged. An advantage of raster graphics is that they will appear onscreen very quickly.
It might seem that vector graphics are obviously the better choice. However, the decision to use vector or raster graphics should be based on the nature of the image. If the image is geometric with clear delineations of color, vector is a good choice. If the image is a photograph of a person or a geographic location, nothing but a bitmap will do. Selecting which format to use is pretty easy; however, each type has its own set of considerations.