To import a bitmap with transparency, create an alpha channel bitmap in your preferred editor (Adobe Fireworks, for example.) For information on working with alpha channels, see the documentation of your bitmap editor. Save the image as a 32-bit image, preferably PNG for best color fidelity. When you import the PNG file into Flash using File > Import, the alpha channel transparency is retained in Flash. If you're using Fireworks, see Using Fireworks and Flash Together for tips on exporting PNG files with transparent backgrounds for use in Flash.

Flash can also import transparent GIF89a images. See below for details. The JPEG format, however, does not support transparency.

Transparent SWF files

It is possible to make the background of a SWF file transparent while it is being played in a browser. For complete details and an example, see Create a transparent background in a SWF file.

Remove the background of imported bitmaps

While it's possible to import bitmaps with transparent backgrounds into Flash, you can also remove the background after the image has been imported.

To remove the background for raster images, do the following:

  1. Choose File > Import to Stage to bring the bitmap into your SWF file.
  2. Select the image.
  3. Choose Modify > Break Apart.
  4. Deselect the image.
  5. Select the Lasso Tool.
  6. Click the Magic wand in the Options pane of the Tools panel.
  7. Select the background areas of the bitmap image.
  8. Press Delete.
  9. Convert the remaining part of the image to a graphic or movie clip symbol.

Known issues with transparent bitmaps

Following are some known issues with preserving transparency in imported bitmaps.

Issue 1

Exporting or publishing static GIF with Transparent selected does not result in a transparent GIF. The background color is still visible.

Solution

Export as a looping 1-frame animated GIF with Transparent selected. 

Issue 2

When you import transparent GIF images into Flash and placing them on the stage, the transparent image areas sometimes display as solid colors.

Explanation

Flash imports GIF files incorrectly depending on the background and index color of the file. If imported GIF files have a different index color than the transparent color, a solid background results in the image display in Flash.

Solution

Create GIF images with the same transparency and index color for use in Flash. When saving or exporting images in GIF format, you have the option to set the transparency and index color of the image. When these colors are set to the same RGB values, Flash properly renders the background color as transparent. For detailed information on this procedure, see your image-editing application documentation.

Issue 3

Transparent areas are "ghosting" in PNG images in Flash when the monitor is running at 16-bit color display. Ghosting is a semi-transparent image appearing in an area that is expected to be transparent.

Explanation

This issue is a symptom of the way Flash dithers colors for 16-bit display.

For displaying alpha areas over solid colors, Flash uses a single pixel value for the entire area of color. When displaying gradients or images, Flash uses a pattern of pixel values so that color changes are smoother. When there's an alpha channel over a solid color, Flash switches from a single pixel value to a pattern of pixel values. This switch causes the ghosting effect seen.

For a technical description of 16-bit color problems in Flash, see HTML colors are different from SWF colors.

Solution

There are three recommended workarounds to this issue:

  • Choose solid colors in which their RGB values are all a multiple of 16. With this color format, the alpha areas don't dither on 16-bit displays. This workaround, however, doesn't prevent ghosting at 8-bit display.
  • Change solid colors to gradients that contain a single color. This technique tricks Flash into always dithering the color and eliminates ghosting.
  • Break apart the bitmap and use the Lasso tool to mask out and delete the transparent portions of the image. This workaround eliminates the ghosted areas, and makes it less noticeable.

Keywords: transparency; transparent; background; gif; bitmap; import; alpha channel; PNG; GIF; JPG; TIFF; wmode; 16 bit; ghost; ghosting; tn_12804

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy