03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The rotate() method alters the a, b, c, <strong>and</strong> d properties of the Matrix object. In matrix<br />

notation this is shown as follows:<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

angle:Number - The rotation angle in radians.<br />

Example<br />

The following example shows how the rotate() method rotates rectangleMc 30° clockwise.<br />

Applying myMatrix to rectangleMc resets its _x value, leaving you to reset it to 100<br />

manually.<br />

import flash.geom.Matrix;<br />

import flash.geom.Transform;<br />

var myMatrix:Matrix = new Matrix();<br />

trace(myMatrix.toString()); // (a=1, b=0, c=0, d=1, tx=0, ty=0)<br />

var degrees:Number = 30;<br />

var radians:Number = (degrees/180) * Math.PI;<br />

myMatrix.rotate(radians);<br />

trace(myMatrix.toString()); // (a=0.866025403784439, b=0.5, c=-0.5,<br />

d=0.866025403784439, tx=0, ty=0)<br />

var rectangleMc:MovieClip = createRectangle(20, 80, 0xFF0000);<br />

trace(rectangleMc._x); // 0<br />

rectangleMc._x = 100;<br />

trace(rectangleMc._x); // 100<br />

var rectangleTrans:Transform = new Transform(rectangleMc);<br />

rectangleTrans.matrix = myMatrix;<br />

trace(rectangleMc._x); // 0<br />

rectangleMc._x = 100;<br />

trace(rectangleMc._x); // 100<br />

788 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!