Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > BitmapData (flash.display.BitmapData) > BitmapData constructor | |||
Creates a BitmapData object with a specified width and height. If you specify a value for the fillColor parameter, every pixel in the bitmap is set to that color.
By default, the bitmap is created as transparent, unless you pass the value false for the transparent parameter. Once you create an opaque bitmap, you cannot change it to a transparent bitmap. Every pixel in an opaque bitmap uses only 24 bits of color channel information. If you define the bitmap as transparent, every pixel uses 32 bits of color channel information, including an alpha transparency channel.
The maximum width and maximum height of a BitmapData object is 2880 pixels. If you specify a width or height value that is greater than 2880, a new instance is not created.
Availability: ActionScript 1.0; Flash Player 8
width:Number - The width of the bitmap image in pixels.
height:Number - The height of the bitmap image in pixels.
transparent:Boolean [optional] - Specifies whether the bitmap image supports per-pixel transparency. The default value is true (transparent). To create a fully transparent bitmap set the value of the transparent parameter to true and the value of the fillColor parameter to 0x00000000 (or to 0).
fillColor:Number [optional] - A 32-bit ARGB color value that you use to fill the bitmap image area. The default value is 0xFFFFFFFF (solid white).
The following example creates a new BitmapData object. The values in this example are the default values for the transparent and fillColor parameters; you could call the constructor without these parameters and get the same result.
import flash.display.BitmapData; var width:Number = 100; var height:Number = 80; var transparent:Boolean = true; var fillColor:Number = 0xFFFFFFFF; var bitmap_1:BitmapData = new BitmapData(width, height, transparent, fillColor); trace(bitmap_1.width); // 100 trace(bitmap_1.height); // 80 trace(bitmap_1.transparent); // true var bitmap_2:BitmapData = new BitmapData(width, height); trace(bitmap_2.width); // 100 trace(bitmap_2.height); // 80 trace(bitmap_2.transparent); // true
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001395.html