MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 44

Director scripting reference
Table of Contents

Advertisement

To create a copy of a list that is independent of another list:
Use the
duplicate()
For example, the following statements create a list and then make an independent copy of the list.
-- Lingo syntax
oldList = ["a", "b", "c"]
newList = oldList.duplicate() -- makes an independent copy of oldList
// JavaScript syntax
var oldList = list("a", "b", "c");
var newList = oldList.duplicate(); // makes an independent copy of oldList
After
is created, editing either
newList
Sorting lists
Lists are sorted in alphanumeric order, with numbers being sorted before strings. Strings are
sorted according to their initial letters, regardless of how many characters they contain. Sorted
lists perform slightly faster than unsorted lists.
A linear list is sorted according to the values in the list. A property list is sorted according to the
property names in the list or array.
After the values in a linear or property list are sorted, they will remain sorted, even as values are
added to or removed from the lists.
To sort a list:
Use the
sort()
For example, the following statements sort a nonsorted alphabetical list.
-- Lingo syntax
oldList = ["d", "a", "c", "b"]
oldList.sort() -- results in ["a", "b", "c", "d"]
// JavaScript syntax
var oldList = list("d", "a", "c", "b");
oldList.sort(); // results in ["a", "b", "c", "d"]
Creating multidimensional lists
You can also create multidimensional lists that enable you to work with the values of more than
one list at a time.
In the following example, the first two statements create the separate linear lists
The third statement creates a multidimensional list and assigns it to
in a multidimensional list, the fourth and fifth statements use brackets to access the values in the
list; the first bracket provides access to a specified list, and the second bracket provides access to
the value at a specified index position in the list.
-- Lingo syntax
list1 = list(5,10)
list2 = list(15,20)
mdList = list(list1, list2)
trace(mdList[1][2]) -- displays 10
trace(mdList[2][1]) -- displays 15
44
Chapter 2: Director Scripting Essentials
method.
oldList
method.
or
has no effect on the other.
newList
mdList
and
.
list1
list2
. To access the values

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Director mx 2004

Table of Contents