Transparency support in Flash
To import a bitmap with transparency, create an alpha channel bitmap in your preferred editor (Macromedia Fireworks, for example.) For information on working with alpha channels refer to the documentation of your bitmap editor. This image must be saved as a 32-bit images, preferably PNG for best color fidelity. Import the PNG file into Flash using File> Import and the alpha channel transparency will be retained in Flash. If you're using Fireworks, see Using Fireworks and Flash Together for tips on exporting PNGs with transparent backgrounds for use in Flash.
Flash can also import transparent GIF89a images. See known issues for details. The JPEG format, however, does not support transparency.
Transparent Flash movies
It is possible to 'drop out' the background of a SWF file being played in a browser. For complete details and an example of this see How to make a Flash movie with a transparent background (TechNote 14201).
Removing the background of imported bitmaps
While its 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:
- Use File > Import to Stage to bring the bitmap into your Flash movie.
- Select the image.
- Choose Modify > Break Apart.
- Deselect the image.
- Select the Lasso Tool.
- Click on the Magic wand in the Options pane of the Tools panel.
- Select the background areas of the bitmap image.
- Hit the Delete key.
- Convert the remaining part of the image to a graphic or movie clip symbol.
Known issues with transparent bitmaps
Below are some known issues with preserving transparency in imported bitmaps.
Issue
When importing transparent GIF images into Flash and placing them on the stage, the transparent image areas may display as solid colors.
Reason
Flash will import 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 will result 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 will properly render the background color as transparent. For detailed information on this procedure, please refer to your image editing application documentation.
For a tutorial on creating transparent GIF images with Macromedia Fireworks see Exporting Transparent GIFs from Fireworks (TechNote 14647).
Issue
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 which should be completely transparent.
Reason
This 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 will use a pattern of pixel values so that color changes are smoother. When there is a color or image with an alpha channel over a solid color, Flash switches from a single pixel value to using a pattern of pixel values. This causes the ghosting effect seen.
For a technical description of 16-bit color problems in Flash see HTML colors look different than SWF colors (TechNote 14819).
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 will not dither on 16-bit displays. This workaround, however, will not prevent ghosting at 8-bit display.
- Change solid colors to gradients that contain a single color. This technique will trick Flash into always dithering the color and will eliminate ghosting.
- Break apart the bitmap and use the Lasso tool to mask out and delete the transparent portions of the image. This workaround will simply eliminate the ghosted areas, and make it less noticeable.
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
