User Guide

768 ActionScript classes
Example
The following example creates the
clonedMatrix variable from the myMatrix variable. The
Matrix class does not have an
equals method, so the following example uses a custom written
function to test the equality of two matrixes.
import flash.geom.Matrix;
var myMatrix:Matrix = new Matrix(2, 0, 0, 2, 0, 0);
var clonedMatrix:Matrix = new Matrix();
trace(myMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)
trace(clonedMatrix); // (a=1, b=0, c=0, d=1, tx=0, ty=0)
trace(equals(myMatrix, clonedMatrix)); // false
clonedMatrix = myMatrix.clone();
trace(myMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)
trace(clonedMatrix); // (a=2, b=0, c=0, d=2, tx=0, ty=0)
trace(equals(myMatrix, clonedMatrix)); // true
function equals(m1:Matrix, m2:Matrix):Boolean {
return m1.toString() == m2.toString();
}
concat (Matrix.concat method)
public concat(m:Matrix) : Void
Concatenates a matrix with the current matrix, effectively combining the geometric effects of
the two. In mathematical terms, concatenating two matrixes is the same as combining them
using matrix multiplication.
For example, if matrix
m1 scales an object by a factor of four, and matrix m2 rotates an object
by 1.5707963267949 radians (
Math.PI/2), m1.concat(m2) transforms m1 into a matrix that
scales an object by a factor of four and rotates the object by
Math.PI/2 radians.
This method replaces the source matrix with the concatenated matrix. If you want to
concatenate two matrixes without altering either of the two source matrixes, you can first copy
the source matrix the clone() method, as shown in the Example section.
Availability: ActionScript 1.0; Flash Player 8
Parameters
m:flash.geom.Matrix - The matrix to be concatenated to the source matrix.