MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 330

Actionscript 2.0 language reference
Table of Contents

Advertisement

sourceRect:flash.geom.Rectangle
to use as input.
destPoint:flash.geom.Point
BitmapData instance) that corresponds to upper-left corner of the source rectangle.
- One of the following comparison operators, passed as a String: "<",
operation:String
"<=", ">", ">=", "==", "!="
- The value that each pixel is tested against to see if it meets or exceeds
threshold:Number
the threshhold.
[optional] - The color value that a pixel is set to if the threshold test succeeds.
color:Number
The default is 0x00000000.
[optional] - The mask to use to isolate a color component. The default value is
mask:Number
0xFFFFFFFF.
copySource:Boolean
source image are copied to the destination when the threshold test fails. If the value is
the source image is not copied when the threshold test fails. The default value is
Returns
- The number of pixels that were changed.
Number
Example
The following example shows how to change the color value of pixels whose color value is
greater than or equal to a certain threshold.
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
myBitmapData.fillRect(new Rectangle(0, 0, 50, 80), 0x00FF0000);
mc.onPress = function() {
myBitmapData.threshold(myBitmapData, new Rectangle(0, 0, 100, 40), new
Point(0, 0), ">=", 0x00CCCCCC, 0x000000FF, 0x00FF0000, false);
}
330
ActionScript classes
- A rectangle that defnes the area of the source image
- The point within the destination image (the current
[optional] - A Boolean value. If the value is
, pixel values from the
true
false
.
false
,

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF