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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example<br />

The following example shows how to copy pixels from one BitmapData instance to another.<br />

import flash.display.BitmapData;<br />

import flash.geom.Rectangle;<br />

import flash.geom.Point;<br />

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

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

var mc_1:MovieClip = this.createEmptyMovieClip("mc",<br />

this.getNextHighestDepth());<br />

mc_1.attachBitmap(bitmapData_1, this.getNextHighestDepth());<br />

var mc_2:MovieClip = this.createEmptyMovieClip("mc",<br />

this.getNextHighestDepth());<br />

mc_2.attachBitmap(bitmapData_2, this.getNextHighestDepth());<br />

mc_2._x = 101;<br />

mc_1.onPress = function() {<br />

bitmapData_2.copyPixels(bitmapData_1, new Rectangle(0, 0, 50, 80), new<br />

Point(51, 0));<br />

}<br />

mc_2.onPress = function() {<br />

bitmapData_1.copyPixels(bitmapData_2, new Rectangle(0, 0, 50, 80), new<br />

Point(51, 0));<br />

}<br />

dispose (BitmapData.dispose method)<br />

public dispose() : Void<br />

Frees memory that is used to store the BitmapData object.<br />

When this method is called on an image, the width <strong>and</strong> height of the image are set to 0. After<br />

a BitmapData object's memory has been freed, calls to methods <strong>and</strong> properties of the<br />

BitmapData instance fail, returning a value of -1.<br />

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

Example<br />

The following example shows how to release the memory of a BitmapData instance, which<br />

results in a cleared instance.<br />

import flash.display.BitmapData;<br />

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

314 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!