MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 19

Director scripting reference
Table of Contents

Advertisement

A decimal number, also called a floating-point number, or float, is any number that includes a
decimal point. In Lingo, the
property controls the number of decimal places
floatPrecision
used to display these numbers. Director always uses the complete number, up to 15 significant
digits, in calculations; Director rounds any number with more than 15 significant digits in
calculations.
JavaScript syntax does not distinguish between integers and floating-point numbers, and merely
uses numbers. For example, the following statements illustrate that the number 1 is an integer in
Lingo and a number in JavaScript syntax, and that the decimal number 1.05 is a float in Lingo
and a number in JavaScript syntax:
-- Lingo syntax
put(ilk(1)) -- #integer
put(ilk(1.05)) -- #float
// JavaScript syntax
trace(typeof(1)) // number
trace(typeof(1.05)) // number
In Lingo, you can convert a decimal to an integer by using the
function. You can
integer()
also convert an integer to a decimal by performing a mathematical operation on the integer, for
example, by multiplying an integer by a decimal. In JavaScript syntax, you can convert a string or
a decimal number to a whole number by using the
function. As opposed to Lingo's
parseInt()
function,
rounds down. For example, the following statement rounds
integer()
parseInt()
off the decimal number 3.9 and converts it to the integer 4 (Lingo) and the number 3
(JavaScript syntax).
-- Lingo syntax
theNumber = integer(3.9) -- results in a value of 4
// JavaScript syntax
var theNumber = parseInt(3.9); // results in a value of 3
In Lingo, the
function can convert a string into a numerical value.
value()
You can also use exponential notation with decimal numbers: for example, -
or
1.1234e-100
.
123.4e+9
In Lingo, you can convert an integer or string to a decimal number by using the
float()
function. In JavaScript syntax, you can convert a string to a decimal number by using the
function. For example, the following statement stores the value 3.0000 (Lingo)
parseFloat()
and 3 (JavaScript syntax) in the variable
.
theNumber
-- Lingo syntax
theNumber = float(3) -- results in a value of 3.0000
// JavaScript syntax
var theNumber = parseFloat(3) // results in a value of 3
Literal values
19

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Director mx 2004

Table of Contents