Writing Scripts with Lingo
399
For example, the following statements have the same effect; each statement creates a linear list of
three names:
set workerList = ["Bruno", "Heather", "Carlos"]
set workerList = list("Bruno", "Heather", "Carlos")
To create an empty linear list:
•
Set the list to
[ ]
.
Creating property lists
The only way to create a property list is to use the list operator (
[ ]
). You cannot use the
list()
function to create a property list.
To create a property list:
•
Place the list elements within the list operator, and use commas to separate the elements.
Precede each property with the pound (#) sign, and separate each property from its value
with a colon.
For example, the following statements create two different property lists. Each list specifies the
Stage coordinates of a sprite.
sprite1Location = [#left:100, #top:150, #right:300, #bottom:350]
sprite2Location = [#left:400, #top:550, #right:500, #bottom:750]
To create an empty property list:
•
Set the list to
[:]
.
Setting and retrieving items in a list
Lingo lets you set and retrieve individual items in a list. The syntax differs for linear and
property lists.
To set a value in a linear list:
•
Use the equals (=) operator. (You can also use the
setAt
command introduced in earlier
versions of Director.)
For example, the statement
workerList[2] = "Tiffany"
makes Tiffany the new value for the
second item in the list workerList.
To retrieve a value in a linear list:
•
Use the list variable followed by the number that indicates the value’s position in the list. Place
square brackets around the number. (You can also use the
getAt
or
getaProp
commands,
which were introduced in earlier versions of Director.)
For example, in the linear list
set workerList = ["Bruno ", "Heather ", "Carlos "]
,
the expression
workerList[2]
represents the second value in the list workerList. The value
is Heather.
Содержание 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...