03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);<br />

trace("filter: " + filter.matrix);<br />

var clonedFilter:ColorMatrixFilter = filter.clone();<br />

matrix = clonedFilter.matrix;<br />

matrix[2] = 1;<br />

clonedFilter.matrix = matrix;<br />

trace("clonedFilter: " + clonedFilter.matrix);<br />

ColorMatrixFilter constructor<br />

public ColorMatrixFilter(matrix:Array)<br />

Initializes a new ColorMatrixFilter instance with the specified parameters.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

matrix:Array - An array of 20 elements arranged in a 4 x 5 matrix.<br />

matrix (ColorMatrixFilter.matrix property)<br />

public matrix : Array<br />

An array of 20 elements for 4 x 5 color transform.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Example<br />

The following example creates a new ColorMatrixFilter instance <strong>and</strong> then changes its matrix<br />

property. The matrix property cannot be changed by directly modifying its value (for<br />

example, clonedFilter.matrix[2] = 1;). Instead, you must get a reference to the array,<br />

make the change to the reference, <strong>and</strong> reset the value using clonedFilter.matrix =<br />

changedMatrix.<br />

import flash.filters.ColorMatrixFilter;<br />

var matrix:Array = new Array();<br />

matrix = matrix.concat([1, 0, 0, 0, 0]); // red<br />

matrix = matrix.concat([0, 1, 0, 0, 0]); // green<br />

matrix = matrix.concat([0, 0, 1, 0, 0]); // blue<br />

matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha<br />

var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);<br />

trace("filter: " + filter.matrix);<br />

var changedMatrix:Array = filter.matrix;<br />

changedMatrix[2] = 1;<br />

filter.matrix = changedMatrix;<br />

434 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!