426
ActionScript classes
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+1) + (min-
.5));
return randomNum;
}
for (var i = 0; i<25; i++) {
trace(randRange(4, 11));
}
See also
ceil (Math.ceil method)
,
floor (Math.floor method)
sin (Math.sin method)
public static sin(x:
Number
) : Number
Computes and returns the sine of the specified angle in radians. To calculate a radian, see the
description of the Math class entry.
Availability:
ActionScript 1.0; Flash Lite 2.0 - 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.
Parameters
x
:
Number
- A number that represents an angle measured in radians.
Returns
Number
- A number; the sine of the specified angle (between -1.0 and 1.0).
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...