MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 14

Director scripting reference
Table of Contents

Advertisement

The
keyword can be used in JavaScript syntax to specify a constant whose value does not
const
change. Lingo has its own predefined set of constants (
keyword
const
For example, the following statement specifies a constant named
to 12. This value will always be 12, and cannot be changed through script.
// JavaScript syntax
const intAuthors = 12;
The
keyword in JavaScript syntax can be placed in front of a term to specify that the term
var
is a variable. The following statement creates a variable named
// JavaScript syntax
var startValue = 0;
Note: Although using var in JavaScript syntax is optional, it is recommended that you always
declare local JavaScript syntax variables, or those inside a function, using var. For more
information on using variables, see
The line continuation symbol (\) in Lingo indicates that a long line of sample code has been
broken into two or more lines. Lines of Lingo that are broken in this way are not separate lines
of code. For example, the following code would still run.
-- Lingo syntax
tTexture = member("3D").model("box") \
.shader.texture
JavaScript syntax does not include a line continuation symbol. To break multiple lines of
JavaScript syntax code, add a carriage return at the end of a line, and then continue the code on
the following line.
Semicolons can be used to specify the end of a statement of JavaScript syntax code. Semicolons
do not apply to Lingo.
Using a semicolon is optional. If used, it is placed at the end of a complete statement. For
example, both of the following statements create a variable named
// JavaScript syntax
var startValue = 0
var startValue = 0;
A semicolon does not necessarily specify the end of a line of JavaScript syntax code, and
multiple statements can be placed on one line. However, placing separate statements on
separate lines is recommended in order to improve readability. For example, the following
three statements occupy only one line of code and function properly, but it is difficult to
read the code.
// JavaScript syntax
_movie.go("Author"); var startValue = 0; _sound.beep();
Character spaces within expressions and statements are ignored in both Lingo and JavaScript
syntax. In strings of characters surrounded by quotation marks, spaces are treated as characters.
If you want spaces in a string, you must insert them explicitly. For example, the first statement
below ignores the spaces between the list items, and the second statement includes the spaces.
-- Lingo syntax
myList1 = ["1",
myList2 = ["
14
Chapter 2: Director Scripting Essentials
does not apply to Lingo.
"Variables" on page
"2",
1
", "
2
", "
,
TAB
EMPTY
21.
"3"] -- yields ["1", "2", "3"]
3
"] -- yields ["
, and so on); therefore, the
and sets its value
intAuthors
.
startValue
.
startValue
1
", "
2
", "
3
"]

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