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.

var pointMc_1:MovieClip = createRectangle(10, 10, 0x00FF00);<br />

pointMc_1._x = deltaTransformedPoint.x;<br />

function createRectangle(width:Number, height:Number,<br />

color:Number):MovieClip {<br />

var depth:Number = this.getNextHighestDepth();<br />

var mc:MovieClip = this.createEmptyMovieClip("mc_" + depth, depth);<br />

mc.beginFill(color);<br />

mc.lineTo(0, height);<br />

mc.lineTo(width, height);<br />

mc.lineTo(width, 0);<br />

mc.lineTo(0, 0);<br />

return mc;<br />

}<br />

identity (Matrix.identity method)<br />

public identity() : Void<br />

Sets each matrix property to a value that cause a transformed movie clip or geometric<br />

construct to be identical to the original.<br />

After calling the identity() method, the resulting matrix has the following properties: a=1,<br />

b=0, c=0, d=1, tx=0, ty=0.<br />

In matrix notation the identity matrix looks like this:<br />

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

Example<br />

The following example demonstrates that calling the identity() method converts the calling<br />

Matrix object to an identity Matrix object. The number <strong>and</strong> types of transformations applied<br />

to the original Matrix object beforeh<strong>and</strong> are irrelevant. If identity() is called, the Matrix<br />

values are converted to (a=1, b=0, c=0, d=1, tx=0, ty=0).<br />

import flash.geom.Matrix;<br />

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

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

myMatrix.rotate(Math.atan(3/4));<br />

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

784 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!