User Guide

590
Examples
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
Syntax
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 lists blank entries to provide the number of places specified by
orderNumber.
Examples
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
When the handler runs, the Message window displays the following:
[12, 34, 6, 10, 45]
You can perform this same operation may be done using bracket access to the list in the
following manner:
on enterFrame
set vNumbers = [12, 34, 6, 7, 45]
vnumbers[4] = 10
put vNumbers
end enterFrame