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.

The source channel value <strong>and</strong> destination channel value can be one of the following values or<br />

the sum of any of the values:<br />

■ 1 (red)<br />

■ 2 (green)<br />

■ 4 (blue)<br />

■ 8 (alpha)<br />

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

Parameters<br />

sourceBitmap:BitmapData - The input bitmap image to use. The source image can be a<br />

different BitmapData object or it can refer to the current BitmapData object.<br />

sourceRect:Rectangle - The source Rectangle object. If you only want to copy channel<br />

data from a smaller area within the bitmap, specify a source rectangle that is smaller than the<br />

overall size of the BitmapData object.<br />

destPoint:Point - The destination Point object that represents the upper-left corner of the<br />

rectangular area where the new channel data is placed. If you want to copy channel data from<br />

one area to a different area in the destination image, specify a point other than (0,0).<br />

sourceChannel:Number - The source channel. Use a value from the set (1,2,4,8), which<br />

represent red, green, blue, <strong>and</strong> alpha channels, respectively, or a sum of any of the values.<br />

destChannel:Number - The destination channel. Use a value from the set (1,2,4,8), which<br />

represent red, green, blue, <strong>and</strong> alpha channels, respectively, or a sum of any of the values.<br />

Example<br />

The following example shows how to copy a source ARGB channel from a BitmapData object<br />

back onto itself at a different location:<br />

import flash.display.BitmapData;<br />

import flash.geom.Rectangle;<br />

import flash.geom.Point;<br />

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

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

this.getNextHighestDepth());<br />

mc.attachBitmap(myBitmapData, this.getNextHighestDepth());<br />

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

myBitmapData.copyChannel(myBitmapData, new Rectangle(0, 0, 50, 80), new<br />

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

}<br />

312 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!