ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > Matrix (flash.geom.Matrix) > identity (Matrix.identity method) | |||
public identity() : Void
Sets each matrix property to a value that cause a transformed movie clip or geometric construct to be identical to the original.
After calling the identity() method, the resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
In matrix notation the identity matrix looks like this:

Availability: ActionScript 1.0; Flash Player 8
The following example demonstrates that calling the identity() method converts the calling Matrix object to an identity Matrix object. The number and types of transformations applied to the original Matrix object beforehand are irrelevant. If identity() is called, the Matrix values are converted to (a=1, b=0, c=0, d=1, tx=0, ty=0).
import flash.geom.Matrix; var myMatrix:Matrix = new Matrix(2, 0, 0, 2, 0 ,0); trace(myMatrix.toString()); // (a=2, b=0, c=0, d=2, tx=0, ty=0) myMatrix.rotate(Math.atan(3/4)); trace(myMatrix.toString()); // (a=1.6, b=1.2, c=-1.2, d=1.6, tx=0, ty=0) myMatrix.translate(100,200); trace(myMatrix.toString()); // (a=1.6, b=1.2, c=-1.2, d=1.6, tx=100, ty=200) myMatrix.scale(2, 2); trace(myMatrix.toString()); // (a=3.2, b=2.4, c=-2.4, d=3.2, tx=200, ty=400) myMatrix.identity(); trace(myMatrix.toString()); // (a=1, b=0, c=0, d=1, tx=0, ty=0)
|
|
|
|