273
getPos()
Syntax
list.getPos(
value
)
getPos(
list
,
value
)
Description
List function; identifies the position of the value specified by
value
in the list specified by
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.
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()
getPref()
Syntax
getPref(
prefFileName
)
Description
Function; retrieves the content of the specified file.
When you use this function, replace
prefFileName
with the name of a file created by the
setPref
function. If no such file exists,
getPref
returns
VOID
.
The filename used for
prefFileName
must be a valid filename only, not a full path; Director
supplies the path. The path to the file is handled by Director. The only valid file extensions for
prefFileName
are .txt and .htm; any other extension is rejected.
Do not use this command to access read-only or locked media.
Note:
In a browser, data written by
setPref
is not private. Any Shockwave movie can read this information and
upload it to a server. Confidential information should not be stored using
setPref
.
To see an example of
getPref()
used in a completed movie, see the Read and Write Text movie
in the Learning/Lingo Examples folder inside the Director application folder.
Example
This handler retrieves the content of the file Test and then assigns the file’s text to the field Total Score:
on mouseUp
theText = getPref("Test")
member("Total Score").text = theText
end
See also
setPref
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...