Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Data and Data Types > About data types > About primitive and complex data types > Number data type | |||
The Number data type is a double-precision floating-point number. The minimum value of a number object is approximately 5e-324. The maximum is approximately 1.79E+308.
You can manipulate numbers using the arithmetic operators addition (+), subtraction (-), multiplication (*), division (/), modulo (%), increment (++), and decrement (--). For more information, see Using numeric operators.
You can also use methods of the built-in Math and Number classes to manipulate numbers. For more information on the methods and properties of these classes, see the Math and Number entries in ActionScript 2.0 Language Reference.
The following example uses the sqrt() (square root) method of the Math class to return the square root of the number 100:
Math.sqrt(100);
The following example traces a random integer between 10 and 17 (inclusive):
var bottles:Number = 0;
bottles = 10 + Math.floor(Math.random() * 7);
trace("There are " + bottles + " bottles");
The following example finds the percent of the intro_mc movie clip that is loaded and represents it as an integer:
var percentLoaded:Number = Math.round((intro_mc.getBytesLoaded() / intro_mc.getBytesTotal()) * 100);
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000645.html