![MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference Download Page 252](http://html1.mh-extra.com/html/macromedia/director-mx-2004-director-scripting/director-mx-2004-director-scripting_reference_3321720252.webp)
252
Chapter 12: Methods
callAncestor
Usage
callAncestor
handlerName
,
script
, {
args
...}
Description
Command; sends a message to a child object’s ancestor script.
Ancestors can, in turn, have their own ancestors.
When you use
callAncestor
, the name of the handler can be a variable, and you can explicitly
bypass the handlers in the primary script and go directly to the ancestor script.
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 example shows how a
callAncestor
statement can call handlers in the ancestor of a
behavior or parent script.
•
This is the parent script:
-- script "man"
property ancestor
on new me, newTool
set ancestor = new(script "Animal", 2)
return me
end
on run me
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
•
The following statements use the parent script and ancestor script.
This statement creates an instance of the parent script:
set m = new(script "man")
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...