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.

import flash.geom.Matrix;<br />

var myMatrix:Matrix = new Matrix(2, 0, 0, 2, 0, 0);<br />

var clonedMatrix:Matrix = new Matrix();<br />

trace(myMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)<br />

trace(clonedMatrix); // (a=1, b=0, c=0, d=1, tx=0, ty=0)<br />

trace(equals(myMatrix, clonedMatrix)); // false<br />

clonedMatrix = myMatrix.clone();<br />

trace(myMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)<br />

trace(clonedMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)<br />

trace(equals(myMatrix, clonedMatrix)); // true<br />

function equals(m1:Matrix, m2:Matrix):Boolean {<br />

return m1.toString() == m2.toString();<br />

}<br />

concat (Matrix.concat method)<br />

public concat(m:Matrix) : Void<br />

Concatenates a matrix with the current matrix, effectively combining the geometric effects of<br />

the two. In mathematical terms, concatenating two matrixes is the same as combining them<br />

using matrix multiplication.<br />

For example, if matrix m1 scales an object by a factor of four, <strong>and</strong> matrix m2 rotates an object<br />

by 1.5707963267949 radians (Math.PI/2), m1.concat(m2) transforms m1 into a matrix that<br />

scales an object by a factor of four <strong>and</strong> rotates the object by Math.PI/2 radians.<br />

This method replaces the source matrix with the concatenated matrix. If you want to<br />

concatenate two matrixes without altering either of the two source matrixes, you can first copy<br />

the source matrix the clone() method, as shown in the Example section.<br />

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

Parameters<br />

m:Matrix - The matrix to be concatenated to the source matrix.<br />

778 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!