getaProp
325
getaProp
Usage
propertyList.propertyName
getaProp(
list
,
item
)
list
[
listPosition
]
propertyList [ #propertyName ]
propertyList [ "propertyName" ]
Description
List command; for linear and property lists, identifies the value associated with the item specified
by
item
,
listPosition
, or
propertyName
in the list specified by
list
.
•
When the list is a linear list, replace
item
with the number for an item’s position in a list as
shown by
listPosition
. The result is the value at that position.
•
When the list is a property list, replace
item
with a property in the list as in
propertyName
.
The result is the value associated with the property.
The
getaProp
command returns
VOID
when the specified value is not in the list.
When used with linear lists, the
getaProp
command has the same function as the
getAt
command.
Parameters
itemNameOrNum
Required. For linear lists, an integer that specifies the index position of the value
in the list to return; for property lists, a symbol (Lingo) or a string (JavaScript syntax) that
specifies the property whose value is returned.
Example
This statement identifies the value associated with the property #joe in the property list ages,
which consists of [#john:10, #joe:12, #cheryl:15, #barbara:22]:
put getaProp(ages, #joe)
The result is 12, because this is the value associated with the property #joe.
The same result can be achieved using bracket access on the same list:
put ages[#joe]
The result is again 12.
If you want the value at a certain position in the list, you can also use bracket access. To get the
third value in the list, associated with the third property, use this syntax:
put ages[3]
-- 15
Note:
Unlike the
getAProp
command where
VOID
is returned when a property doesn’t exist, a script
error will occur if the property doesn’t exist when using bracket access.
See also
getAt
,
getOne()
,
getProp()
,
setaProp
,
setAt
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...