342
Chapter 12: Methods
To see an example of
getPref()
used in a completed movie, see the Read and Write Text movie
in the Learning/Lingo folder inside the Director application folder.
Parameters
stringPrefName
Required. A string that specifies the file for which content is retrieved.
Example
This handler retrieves the content of the file Test and then assigns the file’s text to the field
Total Score:
-- Lingo syntax
on mouseUp
theText = _player.getPref("Test")
member("Total Score").text = theText
end
// JavaScript syntax
function mouseUp() {
var theText = _player.getPref("Test");
member("Total Score").text = theText;
}
See also
Player
,
setPref()
getPos()
Usage
list.getPos(
value
)
getPos(
list
,
value
)
Description
List function; identifies the position of a value in a list. When the specified value is not in the list,
the
getPos
command returns the value 0.
For values contained in the list more than once, only the first occurrence is displayed. This
command performs the same function as the
getOne
command when used for linear lists.
Parameters
value
Required. Specifies the value associated with the position.
Example
This statement identifies the position of the value 12 in the list Answers, which consists of [#a:10,
#b:12, #c:15, #d:22]:
put Answers.getPos(12)
The result is 2, because 12 is the second value in the list.
See also
getOne()
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...