Chapter 16
390
Functions
are terms that return a value. For example, the
date()
function returns the current
date set in the computer. The
key()
function returns the key that was pressed last. Parentheses
occur at the end of a function.
Handlers
are sets of Lingo statements within a script that run when a specific event occurs in a
movie (see “Using handlers” on page 396). For example, the following statements comprise a
handler that plays a beep sound when the mouse button is clicked:
on mouseDown
beep
end
Keywords
are reserved words that have a special meaning. For example,
end
indicates the end of a
handler.
Lists
are ordered sets of values used to track and update an array of data, such as a series of names
or the values assigned to a set of variables (see “Using lists” on page 398). A simple example is a
list of numbers such as
[1, 4, 2]
.
Messages
are notices that Director sends to scripts when specific events occur in a movie (see
“Using messages to identify events” on page 394). For example, when the playhead enters a
specific frame, the
enterFrame
event occurs and Directors sends an
enterFrame
message. If a
script contains an
on enterFrame
handler, the statements within that handler will run, because
the handler received the
enterFrame
message.
Operators
are terms that calculate a new value from one or more values. For example, the addition
(
+
) operator adds two or more values together to produce a new value.
Properties
are attributes that define an object. For example,
picture
is a property of a bitmap
cast member.
Statements
are valid instructions that Director can execute (see “Writing Lingo statements”
on page 392). For example,
go to frame 23
is a statement.
Variables
are elements used to store and update values (see “Storing and updating values in
variables” on page 402). To assign values to variables or change the values of many properties, you
use the equals (
=
) operator or the
set
command. For example, the statement
set startValue =
0
places a value of 0 into a variable named
startValue
.
Lingo syntax
Lingo supports a variety of data types, including references to sprites and cast members,
TRUE
and
FALSE
or 1 and 0 (Boolean) values, strings, constants, integers, floating-point numbers, points,
rects, colors, and dates.
The following are general syntax rules that apply to all Lingo. Most Lingo terms also have their
own individual requirements about terms that they must be combined with. For the rules for a
specific Lingo term, see the term’s syntax in the Lingo Dictionary.
Parentheses
Functions that return values require parentheses. When you define functions in handlers, you
need to include parentheses in the calling statement.
Use parentheses after the keyword
sprite
or
member
to refer to the object’s identifier: for
example,
member("Patrice Lumumba")
refers to the member named Patrice Lumumba.
Содержание 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...