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.

width: 100<br />

}<br />

To further demonstrate the relationships between bitmap_1, bitmap_2, <strong>and</strong> clonedBitmap<br />

the following example modifies the pixel value at (1, 1) of bitmap_1. Modifying pixel value at<br />

(1, 1) demonstrates that the clone() method creates an instance based on values of the<br />

bitmap_1 instance instead of referring to the values.<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.getPixel32(1, 1)); // -16777216<br />

trace(bitmap_2.getPixel32(1, 1)); // -16777216<br />

trace(clonedBitmap.getPixel32(1, 1)); // -16777216<br />

bitmap_1.setPixel32(1, 1, 0xFFFFFF);<br />

trace(bitmap_1.getPixel32(1, 1)); // -1<br />

trace(bitmap_2.getPixel32(1, 1)); // -1<br />

trace(clonedBitmap.getPixel32(1, 1)); // -16777216<br />

colorTransform (BitmapData.colorTransform<br />

method)<br />

public colorTransform(rect:Rectangle, colorTransform:ColorTransform) : Void<br />

Adjusts the color values in a specified area of a bitmap image by using a ColorTransform<br />

object. If the rectangle matches the boundaries of the bitmap image, this method transforms<br />

the color values of the entire image.<br />

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

Parameters<br />

rect:Rectangle - A Rectangle object that defines the area of the image in which the<br />

ColorTransform object is applied.<br />

colorTransform:ColorTransform - A ColorTransform object that describes the color<br />

transformation values to apply.<br />

Example<br />

The following example shows how to apply a color transform operation to a BitmapData<br />

instance.<br />

import flash.display.BitmapData;<br />

BitmapData (flash.display.BitmapData) 309

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

Saved successfully!

Ooh no, something went wrong!