![MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference Download Page 306](http://html.mh-extra.com/html/macromedia/flash-8-actionscript-2-0-language/flash-8-actionscript-2-0-language_reference_687537306.webp)
306
ActionScript classes
Example
The following example shows how to copy pixels from one BitmapData instance to another.
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
var bitmapData_1:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var bitmapData_2:BitmapData = new BitmapData(100, 80, false, 0x00FF0000);
var mc_1:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc_1.attachBitmap(bitmapData_1, this.getNextHighestDepth());
var mc_2:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc_2.attachBitmap(bitmapData_2, this.getNextHighestDepth());
mc_2._x = 101;
mc_1.onPress = function() {
bitmapData_2.copyPixels(bitmapData_1, new Rectangle(0, 0, 50, 80), new
Point(51, 0));
}
mc_2.onPress = function() {
bitmapData_1.copyPixels(bitmapData_2, new Rectangle(0, 0, 50, 80), new
Point(51, 0));
}
dispose (BitmapData.dispose method)
public dispose() : Void
Frees memory that is used to store the BitmapData object.
When this method is called on an image, the width and height of the image are set to 0. After
a BitmapData object's memory has been freed, method and property access calls on the
instance fail, returning a value of -1.
Availability:
ActionScript 1.0; Flash Player 8
Example
The following example shows how to release the memory of a BitmapData instance, which
results in a cleared instance.
import flash.display.BitmapData;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...