300
ActionScript classes
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
clone (BitmapData.clone method)
public clone() : BitmapData
Returns a new BitmapData object that is a clone of the original instance with an exact copy of
the contained bitmap.
Availability:
ActionScript 1.0; Flash Player 8
Returns
flash.display.BitmapData
- A new BitmapData object that is identical to the original.
Example
The following example creates three BitmapData objects and compares them. You can create
the
bitmap_1
instance by using the
BitmapData
constructor. You create the
bitmap_2
instance by setting it equal to
bitmap_1
. You create he
clonedBitmap
instance by cloning
bitmap_1
. Notice that although
bitmap_2
evaluates as being equal to
bitmap_1
,
clonedBitmap
does not, even though it contains the same values as
bitmap_1
.
import flash.display.BitmapData;
var bitmap_1:BitmapData = new BitmapData(100, 80, false, 0x000000);
var bitmap_2:BitmapData = bitmap_1;
var clonedBitmap:BitmapData = bitmap_1.clone();
trace(bitmap_1 == bitmap_2); // true
trace(bitmap_1 == clonedBitmap); // false
for(var i in bitmap_1) {
trace(">> " + i + ": " + bitmap_1[i]);
// >> generateFilterRect: [type Function]
// >> dispose: [type Function]
// >> clone: [type Function]
// >> copyChannel: [type Function]
// >> noise: [type Function]
// >> merge: [type Function]
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...