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, calls to methods and properties of the BitmapData 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);

var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());

mc.onPress = function() {
    myBitmapData.dispose();

    trace(myBitmapData.width); // -1
    trace(myBitmapData.height); // -1
    trace(myBitmapData.transparent); // -1
}

Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001401.html