User Guide
Matrix (flash.geom.Matrix) 781
Example
The following example creates
myMatrix and converts its values to a string in the format of
(a=A, b=B, c=C, d=D, tx=TX, ty=TY).
import flash.geom.Matrix;
var myMatrix:Matrix = new Matrix();
trace("myMatrix: " + myMatrix.toString()); // (a=1, b=0, c=0, d=1, tx=0,
ty=0)
transformPoint (Matrix.transformPoint method)
public transformPoint(pt:Point) : Point
Applies the geometric transformation represented by the Matrix object to the specified point.
Availability: ActionScript 1.0; Flash Player 8
Parameters
pt:flash.geom.Point - The Point (x,y) to be transformed.
Returns
flash.geom.Point - The new Point object.
Example
The following example uses the
transformPoint() method to create transformedPoint
from
myPoint. The translate() method does have an affect on the position of
transformedPoint. In the example, scale() increases the original x value by a factor of
three from 50 to 150, and the
translate() method increases x by 300 for a total value of
450.
import flash.geom.Matrix;
import flash.geom.Point;
var myMatrix:Matrix = new Matrix();
trace(myMatrix); // (a=1, b=0, c=0, d=1, tx=0, ty=0)
myMatrix.translate(100, 0);
trace(myMatrix); // (a=1, b=0, c=0, d=1, tx=100, ty=0)
myMatrix.scale(3, 3);
trace(myMatrix); // (a=3, b=0, c=0, d=3, tx=300, ty=0)
var myPoint:Point = new Point(50,0);
trace(myPoint); // (50, 0)