Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Matrix (flash.geom.Matrix) | |||
Object
|
+-flash.geom.Matrix
public class Matrix
extends Object
The flash.geom.Matrix class represents a transformation matrix that determines how to map points from one coordinate space to another. By setting the properties of a Matrix object and applying it to a MovieClip or BitmapData object you can perform various graphical transformations on the object. These transformation functions include translation (x and y repositioning), rotation, scaling, and skewing.
Together these types of transformations are known as affine transformations. Affine transformations preserve the straightness of lines while transforming, and parallel lines stay parallel.
To apply a transformation matrix to a movie clip, you create a flash.geom.Transform object, and set its Matrix property to the transformation matrix. Matrix objects are also used as parameters of some methods, such as the draw() method of the flash.display.BitmapData class.
A transformation matrix object is considered a 3 x 3 matrix with the following contents:
In traditional transformation matrixes the u, v, and w properties provide extra capabilities. The Matrix class can only operate in two-dimensional space so it always assumes that the property values u and v are 0.0, and that the property value w is 1.0. In other words the effective values of the matrix are as follows:
You can get and set the values of all six of the other properties in a Matrix object: a, b, c, d, tx, and ty.
The Matrix class supports the four major types of transformation functions: translation, scaling, rotation, and skewing. There are specialized methods for three of these functions, as described in the following table.
|
Transformation |
Method |
Matrix values |
Display result |
Description |
|---|---|---|---|---|
|
Translation (displacement) |
|
|
|
Moves the image |
|
Scaling |
|
|
|
Resizes the image, multiplying the location of each pixel by |
|
Rotation |
|
|
|
Rotates the image by an angle |
|
Skewing or shearing |
None; must set the properties |
|
|
Progressively slides the image in a direction parallel to the x or y axis. The |
Each transformation function alters the current matrix properties so that you can effectively combine multiple transformations. To do this, you call more than one transformation function before applying the matrix to its movie clip or bitmap target.
Availability: ActionScript 1.0; Flash Player 8
transform (MovieClip.transform property), Transform (flash.geom.Transform), draw (BitmapData.draw method), a (Matrix.a property), b (Matrix.b property), c (Matrix.c property), d (Matrix.d property), tx (Matrix.tx property), ty (Matrix.ty property), translate (Matrix.translate method), scale (Matrix.scale method), rotate (Matrix.rotate method)
|
Modifiers |
Property |
Description |
|---|---|---|
|
|
The value in the first row and first column of the Matrix object, which affects the positioning of pixels along the x axis when scaling or rotating an image. |
|
|
|
The value in the first row and second column of the Matrix object, which affects the positioning of pixels along the y axis when rotating or skewing an image. |
|
|
|
The value in the second row and first column of the Matrix object, which affects the positioning of pixels along the x axis when rotating or skewing an image. |
|
|
|
The value in the second row and second column of the Matrix object, which affects the positioning of pixels along the y axis when scaling or rotating an image. |
|
|
|
The distance by which to translate each point along the x axis. |
|
|
|
The distance by which to translate each point along the y axis. |
Properties inherited from class Object constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)
|
Signature |
Description |
|---|---|
|
Matrix |
Creates a new Matrix object with the specified parameters. |
|
Modifiers |
Signature |
Description |
|---|---|---|
|
|
Returns a new Matrix object that is a clone of this matrix, with an exact copy of the contained object. |
|
|
|
Concatenates a matrix with the current matrix, effectively combining the geometric effects of the two. |
|
|
|
createBox |
Includes parameters for scaling, rotation, and translation. |
|
|
createGradientBox |
Creates the specific style of matrix expected by the |
|
|
deltaTransformPoint |
Given a point in the pretransform coordinate space, returns the coordinates of that point after the transformation occurs. |
|
|
identity |
Sets each matrix property to a value that cause a transformed movie clip or geometric construct to be identical to the original. |
|
|
invert |
Performs the opposite transformation of the original matrix. |
|
|
Sets the values in the current matrix so that the matrix can be used to apply a rotation transformation. |
|
|
|
Modifies a matrix so that its effect, when applied, is to resize an image. |
|
|
|
Returns a text value listing the properties of the Matrix object. |
|
|
|
transformPoint |
Applies the geometric transformation represented by the Matrix object to the specified point. |
|
|
Modifies a Matrix object so that the effect of its transformation is to move an object along the x and y axes. |
Methods inherited from class Object
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001843.html