Recipe 6.1. Importing Bitmaps


Problem

You want to use an existing bitmap graphic in a Flash movie.

Solution

Import it into the current document using File Import.

Discussion

To use a bitmap graphic, such as a .jpg or .gif file, in your movie, you import it. To do so, select the frame in which you want the graphic to appear, and choose File Import Import to Stage. In the Import dialog box that appears, navigate to the file and click Open. The file is imported to the library and an instance of it appears on the stage. As with symbols and instances, no matter how many times you use a bitmap in a movie, the user has to download it only once. The imported image usually appears at 100% of its size. Occasionally, it may appear at a different size. To restore it to 100%, delete it, and drag out a new instance from the library.

If File Import is grayed out, make sure that a frame in an unlocked layer is selected.


Bitmaps should be placed in their own layers. Bitmaps always stack above vector art within a layer. Even using Modify Arrange Send to Back cannot move a bitmap graphic behind vector artwork. Worse, if you break apart the bitmap for editing (Modify Break Apart, discussed in Recipe 6.2), the bitmap pixels will delete any vector art that they overlap within a layer.

If you want to import the image directly to the library, but don't yet want to put it on the stage, you can take advantage of the Import to Library feature by choosing File Import Import to Library. The Import dialog box displays, and when youve navigated to the file and clicked Open, the bitmap is placed in the library.

Flash is able to import the following types of bitmap graphics:

  • Graphic Interchange Format (.gif), including Animated GIF

  • Joint Photographic Experts Group (.jpg, .jpeg, .jpe)

  • Portable Network Graphic (.png)

  • Windows Bitmap (.bmp, .dib) (Windows)

  • Windows Metafile (.wmf) (Windows)

  • Enhanced Metafile (.emf) (Windows)

  • PICT (.pict) (Macintosh)

In addition, if you have the free Apple QuickTime player installed, Flash is able to install the following types of bitmap graphics:

  • MacPaint (.pntg)

  • Photoshop (.psd)

  • PICT (.pict, .pct, .pic) for Windows

  • QuickTime Image (.qtif)

  • Silicon Graphics Image (.sgi)

  • Truevision TGA (.tga)

  • Tagged Image File Format (.tif, .tiff)

When you import a bitmap, Flash maintains a link to the original file. You can use this link to update the bitmap, if you change the graphic outside of Flash. To update a bitmap, follow these steps:

  1. Open the library by pressing F11 or choosing Window Library.

  2. Click the Properties button at the bottom of the library. The Bitmap Properties dialog box displays.

  3. Click the Update button.

After you click the button, Flash updates the graphic in the library, and all instances of the graphic throughout the movie are also updated. You can use similar steps to replace a bitmap graphic with a different graphic. Instead of choosing Update, choose Import and navigate to the new file. Again, the library and all instances are updated immediately. The graphic name in the library remains unchanged.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net