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.

Returns<br />

Number - A number.<br />

Example<br />

The following example displays Sat Dec 25 00:00:00 GMT-0700 2004, which is the smaller<br />

of the evaluated expressions.<br />

var date1:Date = new Date(2004, 11, 25);<br />

var date2:Date = new Date(2004, 11, 30);<br />

var minDate:Number = Math.min(date1.getTime(), date2.getTime());<br />

trace(new Date(minDate).toString());<br />

See also<br />

max (Math.max method)<br />

PI (Math.PI property)<br />

public static PI : Number<br />

A mathematical constant for the ratio of the circumference of a circle to its diameter,<br />

expressed as pi, with a value of 3.141592653589793.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5 - In Flash Player 4, the methods <strong>and</strong> properties<br />

of the Math class are emulated using approximations <strong>and</strong> might not be as accurate as the nonemulated<br />

math functions that Flash Player 5 supports.<br />

Example<br />

The following example draws a circle using the mathematical constant pi <strong>and</strong> the Drawing<br />

API.<br />

drawCircle(this, 100, 100, 50);<br />

//<br />

function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {<br />

mc.lineStyle(2, 0xFF0000, 100);<br />

mc.moveTo(x+r, 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 />

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 />

764 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!