Chapter 16
398
After a handler intercepts a message, the message doesn’t automatically pass on to the remaining
locations. (You can use the
pass
command to override this default rule and pass the message to
other objects.) If no matching handler is found after the message passes to all possible locations,
Director ignores the message.
The exact order of objects to which Director sends a message depends on the message. For details
about the sequence of objects to which Director sends specific messages, see the Lingo Dictionary
entry for the message.
Using lists
Lists (called arrays in ActionScript and some other languages) provide an efficient way to track
and update an array of data, such as a series of names or the values assigned to a set of variables.
For example, if you know you will need to keep track of many names or numbers in your Director
project, you may want to store them in a list. The list operator
[ ]
designates that the items
within the brackets comprise a list.
You can create two types of lists with Lingo: linear lists and property lists.
•
In a linear list, each element is a single value. For example, this linear list is a simple set of
numbers:
[100, 150, 300, 350]
•
In a property list, each element contains two values separated by a colon. One value is a
property name, always preceded by a pound (#) sign; the other value is the value associated
with that property. For example, the following statement sets the variable
myList
to a property
list containing values for the properties #speed, #direction, and #weight. These could be the
properties of an asteroid.
myList = [#speed: 155, #direction: 237, #weight: 8746]
Properties can appear more than once in a property list.
Both kinds of lists can be empty, containing no values at all. An empty linear list consists of
two square brackets
[ ]
. An empty property list consists of two square brackets surrounding
a colon
[:]
.
It’s usually easier to manipulate a list by assigning it to a variable when you create the list. The
value contained in the variable is actually a reference to the list, not the list itself.
For more information on lists, see
list()
in the Lingo Dictionary.
Creating linear lists
The most common way to create a linear list is to use the list operator (
[ ]
). You can also use the
list()
function to create a linear list.
To create a linear list, do one of the following:
•
Place the list elements within the list operator (
[ ]
).
•
Specify the list’s elements as parameters of the
list()
function. (This function is useful when
you use a keyboard that doesn’t provide square brackets.)
In both cases, you use commas to separate items in the list.
Содержание 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...