424
ActionScript classes
This filter separates each source pixel into its red, green, blue, and alpha components as srcR,
srcG, srcB, srcA. As a final step, it combines each color component back into a single pixel
and writes out the result.
The calculations are performed on unmultiplied color values. If the input graphic consists of
premultiplied color values, those values are automatically converted into unmultiplied color
values for this operation.
The following two optimized modes are available.
Alpha only.
When you pass to the filter a matrix that adjusts only the alpha component, as
shown here, the filter optimizes its performance:
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 N 0 (where N is between 0.0 and 1.0)
Faster version
. Available only with SSE/Altivec accelerator-enabled processors such as
Pentium 3 and later, and Apple G4 and later). The accelerator is used when the multiplier
terms are in the range -15.99 to 15.99 and the adder terms a[4], a[9], a[14], and a[19] are in
the range -8000 to 8000.
A filter is not applied if the resulting image would exceed 2880 pixels in width or height. For
example, if you zoom in on a large movie clip with a filter applied, the filter is turned off if the
resulting image reaches the 2880-pixel limit.
Availability:
ActionScript 1.0; Flash Player 8
Example
The following example uses BitmapFilter to manipulate the color saturation of an image
based on the location of the mouse pointer. If you position the pointer in the upper-left
corner (0,0), the image should be unmodified. As you move the pointer to the right, the green
and blue channels together are removed from the image. As you move the pointer down, the
red channel is removed. If the pointer is positioned at the lower right of the Stage, the image
should be completely black. This example assumes that you have an image in your library
with its Linkage Identifier set to "YourImageLinkage".
import flash.filters.BitmapFilter;
import flash.filters.ColorMatrixFilter;
var image:MovieClip = this.attachMovie("YourImageLinkage", "YourImage",
this.getNextHighestDepth());
image.cacheAsBitmap = true;
var listener:Object = new Object();
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...