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.
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.
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:
Exporting or publishing static GIF with Transparent selected does not result in a transparent GIF. The background color is still visible.
When you import transparent GIF images into Flash and placing them on the stage, the transparent image areas sometimes display as solid colors.
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.
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.
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.
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.
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.