03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

trace(bitmap_1.width); // 100<br />

trace(bitmap_1.height); // 80<br />

trace(bitmap_1.transparent); // true<br />

var bitmap_2:BitmapData = new BitmapData(width, height);<br />

trace(bitmap_2.width); // 100<br />

trace(bitmap_2.height); // 80<br />

trace(bitmap_2.transparent); // true<br />

clone (BitmapData.clone method)<br />

public clone() : BitmapData<br />

Returns a new BitmapData object that is a clone of the original instance with an exact copy of<br />

the contained bitmap.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Returns<br />

BitmapData - A new BitmapData object that is identical to the original.<br />

Example<br />

The following example creates three BitmapData objects <strong>and</strong> compares them. You can create<br />

the bitmap_1 instance by using the BitmapData constructor. You create the bitmap_2<br />

instance by setting it equal to bitmap_1. You create he clonedBitmap instance by cloning<br />

bitmap_1. Notice that although bitmap_2 evaluates as being equal to bitmap_1,<br />

clonedBitmap does not, even though it contains the same values as bitmap_1.<br />

import flash.display.BitmapData;<br />

var bitmap_1:BitmapData = new BitmapData(100, 80, false, 0x000000);<br />

var bitmap_2:BitmapData = bitmap_1;<br />

var clonedBitmap:BitmapData = bitmap_1.clone();<br />

trace(bitmap_1 == bitmap_2); // true<br />

trace(bitmap_1 == clonedBitmap); // false<br />

for(var i in bitmap_1) {<br />

trace(">> " + i + ": " + bitmap_1[i]);<br />

// >> generateFilterRect: [type Function]<br />

// >> dispose: [type Function]<br />

// >> clone: [type Function]<br />

// >> copyChannel: [type Function]<br />

// >> noise: [type Function]<br />

// >> merge: [type Function]<br />

// >> paletteMap: [type Function]<br />

BitmapData (flash.display.BitmapData) 307

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!