MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 358

Actionscript language reference
Table of Contents

Advertisement

Returns
A number; an integer.
Description
Method; rounds the value of the parameter
the value. If parameter
.5), the value is rounded up to the next higher integer.
Example
The following example returns a random number between two specified integers.
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.round(Math.random()*(max-min))+min;
return randomNum;
}
for (var i = 0; i<25; i++) {
trace(randRange(4, 11));
}
See Also
Math.ceil(),
Math.sin()
Availability
Flash Player 5. In Flash Player 4, the methods and properties of the Math class are emulated using
approximations and might not be as accurate as the non-emulated math functions that Flash
Player 5 supports.
Usage
Math.sin(x:Number) : Number
Parameters
A number that represents an angle measured in radians.
x
Returns
A number; the sine of the specified angle (between -1.0 and 1.0).
Description
Method; computes and returns the sine of the specified angle in radians. To calculate a radian, see
"Description" on page 344
Example
The following example draws a circle using the mathematical constant pi, the sine of an angle,
and the Drawing API.
drawCircle(this, 100, 100, 50);
//
function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {
mc.lineStyle(2, 0xFF0000, 100);
358
Chapter 6: ActionScript Core Classes
is equidistant from its two nearest integers (that is, the number ends in
x
Math.floor()
of the Math class entry.
up or down to the nearest integer and returns
x

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents