ColorMatrixFilter (flash.filters.ColorMatrixFilter)
427
var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
trace("filter: " + filter.matrix);
var clonedFilter:ColorMatrixFilter = filter.clone();
matrix = clonedFilter.matrix;
matrix[2] = 1;
clonedFilter.matrix = matrix;
trace("clonedFilter: " + clonedFilter.matrix);
ColorMatrixFilter constructor
public ColorMatrixFilter(matrix:Array)
Initializes a new ColorMatrixFilter instance with the specified parameters.
Availability:
ActionScript 1.0; Flash Player 8
Parameters
matrix
:Array
- An array of 20 elements arranged in a 4 x 5 matrix.
matrix (ColorMatrixFilter.matrix property)
public matrix : Array
An array of 20 elements for 4 x 5 color transform.
Availability:
ActionScript 1.0; Flash Player 8
Example
The following example creates a new ColorMatrixFilter instance and then changes its
matrix
property. The
matrix
property cannot be changed by directly modifying its value (for
example,
clonedFilter.matrix[2] = 1;
). Instead, you must get a reference to the array,
make the change to the reference, and reset the value using
clonedFilter.matrix =
changedMatrix
.
import flash.filters.ColorMatrixFilter;
var matrix:Array = new Array();
matrix = matrix.concat([1, 0, 0, 0, 0]); // red
matrix = matrix.concat([0, 1, 0, 0, 0]); // green
matrix = matrix.concat([0, 0, 1, 0, 0]); // blue
matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha
var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
trace("filter: " + filter.matrix);
var changedMatrix:Array = filter.matrix;
changedMatrix[2] = 1;
filter.matrix = changedMatrix;
trace("filter: " + filter.matrix);
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...