setAt
527
•
The
setaProp
command can also set
ancestor
properties.
Parameters
listProperty
Required. A symbol (Lingo only) or a string that specifies the name of the
property whose value is changing.
newValue
Required. The new value for the
listProperty
property.
Example
These statements create a property list and then adds the item
#c:10
to the list:
newList = [#a:1, #b:5]
put newList
-- [#a:1, #b:5]
setaProp newList, #c, 10
put newList
Using the dot operator, you can alter the property value of a property already in a list without
using
setaProp
:
newList = [#a:1, #b:5]
put newList
-- [#a:1, #b:5]
newList.b = 99
put newList
-- [#a:1, #b:99]
Note:
To use the dot operator to manipulate a property, the property must already exist in the list,
child object, or behavior.
See also
ancestor
,
property
,
. (dot operator)
setAt
Usage
setAt
list
,
orderNumber
,
value
list
[
orderNumber
] =
value
Description
Command; replaces the item specified by
orderNumber
with the value specified by
value
in the
list specified by
list
. When
orderNumber
is greater than the number of items in a property list,
the
setAt
command returns a script error. When
orderNumber
is greater than the number of
items in a linear list, Director expands the list’s blank entries to provide the number of places
specified by
orderNumber
.
Example
This handler assigns a name to the list [12, 34, 6, 7, 45], replaces the fourth item in the list with
the value 10, and then displays the result in the Message window:
on enterFrame
set vNumbers = [12, 34, 6, 7, 45]
setAt vnumbers, 4, 10
put vNumbers
end enterFrame
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...