translate (Matrix.translate method)

public translate(tx:Number, ty:Number) : Void

Modifies a Matrix object so that the effect of its transformation is to move an object along the x and y axes.

The translate() method alters the tx and ty properties of the matrix object. In matrix notation this is shown as:



Availability: ActionScript 1.0; Flash Player 8

Parameters

tx:Number - The amount of movement along the x axis to the right, in pixels.

ty:Number - The amount of movement down along the y axis, in pixels.

Example

The following example uses the translate() method to position rectangleMc x:100 and y:50. The translate() method affects the translation properties tx and ty, but it doesn't affect the a, b, c, or d properties.

import flash.geom.Matrix;

var myMatrix:Matrix = new Matrix(2, 0, 0, 2, 100, 100);
trace(myMatrix.toString()); // (a=2, b=0, c=0, d=2, tx=100, ty=100)

myMatrix.translate(100, 50);
trace(myMatrix.toString()); // (a=2, b=0, c=0, d=2, tx=200, ty=150)

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/00001860.html