EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Matrix (Convolutionfilter.matrix Property)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
ConvolutionFilter (flash.filters.ConvolutionFilter) 467
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
matrix property cannot be changed by directly modifying the values (for example,
myFilter.matrix[2] = 1;). Instead, as shown in the following example, you must get a
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
matrix property of filter from one that blurs a bitmap
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);
}

Table of Contents

Related product manuals