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);

Version 8