250
Chapter 12: Methods
// JavaScript syntax
function checkCache() {
if (cacheSize() < 1000) {
alert("increasing cache to 1MB");
cacheSize(1000);
}
}
See also
cacheDocVerify()
,
clearCache
call
Usage
call #
handlerName
,
script
, {
args
...}
call (#
handlerName
,
scriptInstance
, {
args
...})
Description
Command; sends a message that invokes a handler in a specified script or list of scripts.
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.
Parameters
symHandlerName
Required. A symbol that specifies the handler to activate.
scriptInstance
Required. A reference to the script or list of scripts that contains the handler.
If
scriptInstance
is a single script instance, an error alert occurs if the handler is not defined
in the script’s ancestor script. If
scriptInstance
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.
args
Optional. Any optional parameters to be passed to the handler.
Example
This handler sends the message bumpCounter to the first behavior script attached to sprite 1:
-- Lingo syntax
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
// JavaScript syntax
function mouseDown() {
// get the reference to the first behavior of sprite 1
xref = getAt(sprite(1).script(1));
// run the bumpCounter handler in the referenced script
call(symbol("bumpcounter"), xref, 2);
}
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...