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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

var halfScaleMatrix:Matrix = doubleScaleMatrix.clone();<br />

halfScaleMatrix.invert();<br />

rectangleTrans_2.matrix = halfScaleMatrix;<br />

rectangleMc_2._x = 200;<br />

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

var originalAndInverseMatrix:Matrix = doubleScaleMatrix.clone();<br />

originalAndInverseMatrix.concat(halfScaleMatrix);<br />

rectangleTrans_3.matrix = originalAndInverseMatrix;<br />

rectangleMc_3._x = 300;<br />

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

ty=0)<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 />

Matrix constructor<br />

public Matrix([a:Number], [b:Number], [c:Number], [d:Number], [tx:Number],<br />

[ty:Number])<br />

Creates a new Matrix object with the specified parameters. In matrix notation the properties<br />

will be organized like this:<br />

If you do not provide any parameters to the new Matrix() constructor it creates an "identity<br />

matrix" with the following values:<br />

a = 1 b = 0<br />

c = 0 d = 1<br />

tx = 0 ty = 0<br />

786 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!