clone (ColorMatrixFilter.clone method)

public clone() : ColorMatrixFilter

Returns a copy of this filter object.

Availability: ActionScript 1.0; Flash Player 8

Returns

flash.filters.ColorMatrixFilter - A new ColorMatrixFilter instance with all the same properties as the original one.

Example

The following example creates a new ColorMatrixFilter instance and then clones it using the clone method. The matrix property cannot be changed directly (for example, clonedFilter.matrix[2] = 1;). Instead, you must get a reference to the array, make the change, 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 clonedFilter:ColorMatrixFilter = filter.clone();
matrix = clonedFilter.matrix;
matrix[2] = 1;
clonedFilter.matrix = matrix;
trace("clonedFilter: " + clonedFilter.matrix);

Version 8