Lingo Dictionary
115
call
Syntax
call #
handlerName
,
script
, {
args
...}
call (#
handlerName
,
scriptInstance
, {
args
...})
Description
Command; sends a message that invokes a handler in specified scripts where
handlerName
is the
name of the handler to be activated,
script
references the script or a list of scripts, and
args
are
any optional parameters to be passed to the handler.
If
script
is a single script instance, an error alert occurs if the handler is not defined in the
script’s ancestor script.
If
script
is a list of script instances, the message is sent to each item in the list in turn; if the
handler is not defined in the ancestor script, no alert is generated.
The
call
command can use a variable as the name of the handler. Messages passed using
call
are
not passed to other scripts attached to the sprite, cast member scripts, frame scripts, or movie scripts.
Examples
This handler sends the message bumpCounter to the first behavior script attached to sprite 1:
on mouseDown me
-- get the reference to the first behavior of sprite 1
set xref = getAt (the scriptInstanceList of sprite 1,1)
-- run the bumpCounter handler in the referenced script,
-- with a parameter
call (#bumpCounter, xref, 2)
end
The following example shows how a
call
statement can call handlers in a behavior or parent
script and its ancestor.
•
This is the parent script:
-- script Man
property ancestor
on new me
set ancestor = new(script "Animal", 2)
return me
end
on run me, newTool
put "Man running with "&the legCount of me&" legs"
end
•
This is the ancestor script:
-- script Animal
property legCount
on new me, newLegCount
set legCount = newLegCount
return me
end
on run me
put "Animal running with "& legCount &" legs"
end
on walk me
put "Animal walking with "& legCount &" legs"
end
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...