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 - An integer that is both closest to, <strong>and</strong> greater than or equal to, parameter x.<br />

Example<br />

The following code returns a value of 13:<br />

Math.ceil(12.5);<br />

See also<br />

floor (Math.floor method), round (Math.round method)<br />

cos (Math.cos method)<br />

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

Computes <strong>and</strong> returns the cosine of the specified angle in radians. To calculate a radian, see<br />

the description of the Math class entry.<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 />

Parameters<br />

x:Number - A number that represents an angle measured in radians.<br />

Returns<br />

Number - A number from -1.0 to 1.0.<br />

Example<br />

The following example displays the cosine for several different angles.<br />

trace (Math.cos(0)); // 0 degree angle. Output: 1<br />

trace (Math.cos(Math.PI/2)); // 90 degree angle. Output: 6.12303176911189e-<br />

17<br />

trace (Math.cos(Math.PI)); // 180 degree angle. Output: -1<br />

trace (Math.cos(Math.PI*2)); // 360 degree angle. Output: 1<br />

Note: The cosine of a 90 degree angle is zero, but because of the inherent inaccuracy of<br />

decimal calculations using binary numbers, Flash Player will report a number extremely close<br />

to, but not exactly equal to, zero.<br />

758 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!