Using Director > Parent Scripts > Ancestor basics |
![]() ![]() ![]() |
Ancestor basics
Parent scripts can declare ancestors, which are additional scripts whose handlers and properties a child object can call on and use.
Ancestor scripting lets you create a set of handlers and properties that you can use and reuse for multiple parent scripts.
A parent script makes another parent script its ancestor by assigning the script to its ancestor
property. For example, the following statement makes the script What_Everyone_Does an ancestor to the parent script in which the statement occurs:
set ancestor to new(script "What_Everyone_Does")
When handlers and properties are not defined in a child object, Director searches for the handler or property in the child's ancestors, starting with the child's parent script. If a handler is called or a property is tested and the parent script contains no definition for it, Director searches for a definition in the ancestor script. If a definition exists in the ancestor script, that definition is used.
A child object can have only one ancestor at a time, but that ancestor script can have its own ancestor, which can also have an ancestor, and so on. This lets you create a series of parent scripts whose handlers are available to a child object.
See ancestor
.
![]() ![]() ![]() |