Writing Scripts with Lingo
391
You can also use parentheses to override Lingo’s order of precedence in math operations or to
make your Lingo statements easier to read.
For example, this math expression will yield a result of 13:
5 * 3 - 2
while this expression will yield a result of 5:
5 * (3 - 2)
Character spaces
Words within expressions and statements are separated by spaces. Lingo ignores extra spaces.
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.
You can see Lingo that uses strings in “Writing strings” on page 405.
Uppercase and lowercase letters
Lingo is not case-sensitive—you can use uppercase and lowercase letters however you want. For
example, the following statements are equivalent:
Set the hiLite of member "cat" to True
set the hilite of member "Cat" to True
SET THE HILITE OF MEMBER "CAT" TO TRUE
Set The Hilite Of Member "Cat" To True
However, it’s a good habit to follow script writing conventions, such as the ones that are used in
this book, to make it is easier to identify names of handlers, variables, and cast members when
reading Lingo code.
Literal strings are case-sensitive. See “Writing strings” on page 405.
Comments
Comments in scripts are preceded by double hyphens (
--
). You can place a comment on its own
line or after any statement. Lingo ignores any text following the double hyphen on the same line.
Comments can consist of anything you want, such as notes about a particular script or handler or
notes about a statement whose purpose might not be obvious. Comments make it easier for you
or someone else to understand a procedure after you’ve been away from it for a while.
Adding large numbers of comments does not increase the size of your movie file when it is
saved as a compressed DCR or DXR file. Comments are removed from the file during the
compression process.
Double hyphens can also be used to make Lingo ignore sections of code you want to deactivate
for testing or debugging purposes. By adding double hyphens rather than removing the code,
you can temporarily turn it into comments. Select the code you want to turn on or off and then
use the Comment or Uncomment buttons in the Script window to add or remove double
hyphens easily.
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...