03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - 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.

}<br />

mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);<br />

mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x, -<br />

Math.sin(Math.PI/4)*r+y);<br />

mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);<br />

mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x, -<br />

Math.sin(Math.PI/4)*r+y);<br />

mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);<br />

See also<br />

acos (Math.acos method), asin (Math.asin method), atan (Math.atan method),<br />

atan2 (Math.atan2 method), cos (Math.cos method), tan (Math.tan method)<br />

sqrt (Math.sqrt method)<br />

public static sqrt(x:Number) : Number<br />

Computes <strong>and</strong> returns the square root of the specified number.<br />

Parameters<br />

x:Number - A number or expression greater than or equal to 0.<br />

Returns<br />

Number - A number if parameter x is greater than or equal to zero; NaN (not a number)<br />

otherwise.<br />

Example<br />

The following example uses Math.pow <strong>and</strong> Math.sqrt to calculate the length of a line.<br />

this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());<br />

var mouseListener:Object = new Object();<br />

mouseListener.onMouseDown = function() {<br />

this.origX = _xmouse;<br />

this.origY = _ymouse;<br />

};<br />

mouseListener.onMouseUp = function() {<br />

this.newX = _xmouse;<br />

this.newY = _ymouse;<br />

var minY = Math.min(this.origY, this.newY);<br />

var nextDepth:Number = canvas_mc.getNextHighestDepth();<br />

var line_mc:MovieClip =<br />

canvas_mc.createEmptyMovieClip("line"+nextDepth+"_mc", nextDepth);<br />

line_mc.moveTo(this.origX, this.origY);<br />

line_mc.lineStyle(2, 0x000000, 100);<br />

line_mc.lineTo(this.newX, this.newY);<br />

Math 391

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

Saved successfully!

Ooh no, something went wrong!