bitmapInstance.getBits()
Availability
Flash MX 2004.
Usage
bitmapInstance.getBits()
Parameters
None.
Returns
An object that contains
properties. The
bits
the form
"#rrggbb"
Note: The byte array is meaningful only when referenced by an external library. You typically use it
only when creating an extensible tool or effect.
Description
Method; lets you create bitmap effects by getting the bits out of the bitmap, manipulating them,
and then returning them to Flash. See also
Example
The following code creates a reference to the currently selected object; tests whether the object is a
bitmap; and traces the height, width, and bit depth of the bitmap:
var isBitmap = fl.getDocumentDOM().selection[0].instanceType;
if(isBitmap == "bitmap"){
var bits = fl.getDocumentDOM().selection[0].getBits();
fl.trace("height = " + bits.height);
fl.trace("width = " + bits.width);
fl.trace("depth = " + bits.depth);
}
bitmapInstance.hPixels
Availability
Flash MX 2004.
Usage
bitmapInstance.hPixels
Description
Read-only property; an integer that represents the width of the bitmap, in pixels.
Example
The following code retrieves the width of the bitmap in pixels:
// Get the number of pixels in the horizontal dimension.
var bmObj = fl.getDocumentDOM().selection[0];
44
Chapter 3: Objects
,
,
width
height
depth
element is an array of bytes. The
. The length of the array is the length of the color table.
,
, and, if the bitmap has a color table,
bits
element is an array of color values of
cTab
bitmapInstance.setBits()
cTab
.
Need help?
Do you have a question about the FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY and is the answer not in the manual?