![MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference Download Page 39](http://html1.mh-extra.com/html/macromedia/director-mx-2004-director-scripting/director-mx-2004-director-scripting_reference_3321720039.webp)
Linear lists and property lists
39
You can also create empty linear lists. The following statements create empty linear lists.
-- Lingo syntax
workerList = [] -- using the Lingo list operator
workerList = list() -- using list() with no parameters
// JavaScript syntax
var workerList = list(); // using list() with no parameters
Creating property lists
You create a property list in one of the following ways:
•
In Lingo, use either the top level
propList()
function or the list operator (
[:]
). When using
the list operator to create a property list, you can use a either a colon to designate name/value
elements and commas to separate elements in the list, or commas to both designate name/value
elements and to separate elements in the list.
•
In JavaScript syntax, use the top level
propList()
function and insert commas to both
designate name/value elements and to separate elements in the list.
When you use the top level
propList()
function, you specify the property list’s elements as
parameters of the function. This function is useful when you use a keyboard that does not provide
square brackets.
Properties can appear more than once in a given property list.
All of the following statements create a property list with four property names—
left
,
top
,
right
, and
bottom
—and their corresponding values.
-- Lingo syntax
sprite1Loc = [#left:100, #top:150, #right:300, #bottom:350]
sprite1Loc = ["left",400, "top",550, "right",500, "bottom",750]
sprite1Loc = propList("left",400, "top",550, "right",500, "bottom",750)
// JavaScript syntax
var sprite1Loc = propList("left",400, "top",550, "right",500, "bottom",750);
You can also create empty property lists. The following statements create empty property lists.
-- Lingo syntax
sprite1Loc = [:] -- using the Lingo property list operator
sprite1Loc = propList() -- using propList() with no parameters
// JavaScript syntax
var sprite1Loc = propList(); // using propList() with no parameters
Setting and retrieving items in lists
You can set and retrieve individual items in a list. The syntax differs for linear and property lists.
To set a value in a linear list, do one of the following:
•
Use the equals (=) operator.
•
Use the
setAt()
method.
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...