| Programming ActionScript 3.0 > Overview of ActionScript Programming > Display Programming > Basics for working with the core display classes > Creating and manipulating bitmaps | |||
The BitmapData class lets you manipulate the pixels of a Bitmap object. This can be a bitmap that you loaded from a file, or one that you draw exclusively through one of the BitmapData methods. Each Bitmap object has a bitmapData property that is a BitmapData object.
A BitmapData object represents a rectangular array of pixels. You can create a new bitmap programmatically. The BitmapData constructor lets you create a rectangle with a specified color, and you can attach that BitmapData object to a new Bitmap object, as shown in the following example:
var bdWidth:Number = 100;
var bdHeight:Number = 100;
var bdTransparent:Boolean = true;
var bdFillColorARGB:uint = 0xFF007090;
var myBitmapData:BitmapData = new BitmapData(bdWidth,
bdHeight,
bdTransparent,
bdFillColorARGB);
var myBitmap:Bitmap = new Bitmap(myBitmapData);
addChild(myBitmap)
More commonly, however, you will work with bitmap data from a loaded image file. In either case, the BitmapData class includes methods for working with and modifying the BitmapData. For example, you can use the setPixel() method to set a pixel to a specific RGB value. For details on properties and methods of the Bitmap and BitmapData class, see the ActionScript 3.0 Language Reference.
Note that the bitmapData property of multiple Bitmap objects can reference the same BitmapData object, and you can apply different effects and transformations to each Bitmap object.
Flex 2.01