beautypg.com

Bitmapinstance.hpixels – Adobe Extending Flash Professional CS5 User Manual

Page 54

background image

32

EXTENDING FLASH PROFESSIONAL

BitmapInstance object

Last updated 5/2/2011

The byte array is meaningful only when referenced by a DLL or shared library. You typically use it only when creating
an extensible tool or effect. For information on creating DLLs for use with Flash JavaScript, see

C-Level Extensibility

on page 528

Description
Method; lets you create bitmap effects by getting the bits out of the bitmap, manipulating them, and then returning
them to Flash.

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);

}

See also

bitmapInstance.setBits()

bitmapInstance.hPixels

Availability
Flash MX 2004.

Usage

bitmapInstance.hPixels

Description
Read-only property; an integer that represents the width of the bitmap—that is, the number of pixels in the horizontal
dimension.

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];

var isBitmap = bmObj.instanceType;

if(isBitmap == "bitmap"){

var numHorizontalPixels = bmObj.hPixels;

}

See also

bitmapInstance.vPixels

This manual is related to the following products: