MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 36

Director scripting reference
Table of Contents

Advertisement

After a handler intercepts a message, the message does not automatically pass on to the remaining
locations. However, in Lingo you can use the
pass the message to other objects.
If no matching handler is found after the message passes to all possible locations, Director ignores
the message.
The exact order of objects to which Director sends a message depends on the message. For
information on the sequence of objects to which Director sends specific messages, see the entry
for each message in
Using parameters to pass values to a handler
By using parameters for values, you can give the handler exactly the values that it needs to use at a
specific time, regardless of where or when you call the handler in the movie. Parameters can be
optional or required, depending on the situation.
To create parameters for a handler:
In Lingo, put the parameters after the handler name. In JavaScript syntax, put the parameters
within parentheses, and then put them after the handler name. Use commas to separate
multiple parameters.
When you call a handler, you must provide specific values for the parameters that the handler
uses. You can use any type of value, such as a number, a variable that has a value assigned, or a
string of characters. Values in the calling statement must be in the order that they follow in the
handler's parameters, and they must be surrounded by parentheses.
In the following example, the variable assignment
passed the two values 2 and 4. The
with the two values passed to it, stores the result in the local variable
to send the result back to the original method, which is then assigned to
return
Because 2 is first in the list of parameters, it is substituted for
is second in the list of parameters, it is substituted for
-- Lingo syntax
mySum = addThem(2, 4) -- calling statement
on addThem a, b -- handler
c = a + b
return c -- returns the result to the calling statement
end
// JavaScript syntax
var mySum = addThem(2, 4); // calling statement
function addThem(a, b) { // handler
c = a + b;
return c; // returns the result to the calling statement
}
In Lingo, when you call a custom method from an object, a reference to the script object in
memory is always passed as an implied first parameter to the handler for that method. This means
that you must account for the script object reference in your handler.
36
Chapter 2: Director Scripting Essentials
Chapter 10, "Events and Messages," on page
addThem
method to override this default rule and
pass()
159.
calls the method
mySum
handler replaces the parameter placeholders
in the handler. Likewise, because 4
a
in the handler.
b
, which is
addThem
a
, and then uses the keyword
c
.
mySum
and
b

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Director mx 2004

Table of Contents