mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
myBitmapData.noise(128);
mc.onPress = function() {
var newDivisor:Number = 6;
filter.divisor = newDivisor;
myBitmapData.applyFilter(myBitmapData, myBitmapData.rectangle, new
Point(0, 0), filter);
}
matrix (ConvolutionFilter.matrix property)
public matrix : Array
An array of values used for matrix transformation; returns a copy. The number of items in the
array must equal
matrixX*matrixY
The
property cannot be changed by directly modifying the values (for example,
matrix
myFilter.matrix[2] = 1;
reference to the array, make the change to the reference, and reset the value using
filter.matrix = newMatrix;
Availability: ActionScript 1.0; Flash Player 8
Example
The following example changes the
to one that sharpens it.
import flash.filters.ConvolutionFilter;
import flash.display.BitmapData;
var filter:ConvolutionFilter = new ConvolutionFilter(3, 3, [1, 1, 1, 1, 1,
1, 1, 1, 1], 9);
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00FF0000);
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
myBitmapData.noise(128);
mc.onPress = function() {
var newMatrix:Array = [0, -1, 0, -1, 8, -1, 0, -1, 0];
filter.matrix = newMatrix;
myBitmapData.applyFilter(myBitmapData, myBitmapData.rectangle, new
Point(0, 0), filter);
}
.
). Instead, as shown in the following example, you must get a
.
property of
matrix
ConvolutionFilter (flash.filters.ConvolutionFilter)
from one that blurs a bitmap
filter
467
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?