446
objectP()
Syntax
objectP(
expression
)
Description
Function; indicates whether the expression specified by
expression
is an object produced by a
parent script, Xtra, or window (
TRUE
) or not (
FALSE
).
The P in
objectP
stands for predicate.
It is good practice to use
objectP
to determine which items are already in use when you create
objects by parent scripts or Xtra instances.
To see an example of
objectP()
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 Lingo checks whether the global variable
gDataBase
has an object assigned to it and, if not,
assigns one. This check is commonly used when you perform initializations at the beginning of a
movie or section that you don’t want to repeat.
if objectP(gDataBase) then
nothing
else
gDataBase = script("Database Controller").new()
end if
See also
floatP()
,
ilk()
,
integerP()
,
stringP()
,
symbolP()
of
The word
of
is part of many Lingo properties, such as
foreColor
,
number
,
name
, and so on.
offset() (string function)
Syntax
offset(
stringExpression1
,
stringExpression2
)
Description
Function; returns an integer indicating the position of the first character of
stringExpression1
in
stringExpression2
. This function returns 0 if
stringExpression1
is not found in
stringExpression2
. Lingo counts spaces as characters in both strings.
On the Macintosh, the string comparison is not sensitive to case or diacritical marks. For
example, Lingo considers a and Å to be the same character on the Macintosh.
Examples
This statement displays in the Message window the beginning position of the string “media”
within the string “Macromedia”:
put offset("media","Macromedia")
The result is 6.
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...