MACROMEDIA DIRECTOR MX-USING DIRECTOR MX Use Manual page 419

Table of Contents

Advertisement

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
in the Lingo Dictionary.
ancestor
Writing a parent script
A parent script contains the Lingo needed to create child objects and define their possible actions
and properties. First you need to decide how you want the child objects to behave. Then you can
write a parent script that does the following:
Optionally declares any appropriate property variables; these variables represent properties for
which each child object can contain a value independent of other child objects. See "Parent
script and child object basics" on page 418.
Sets up the initial values of the child objects' properties and variables in the
Contains additional handlers that control the child objects' actions.
Declaring property variables
Each child object created from the same parent script initially contains the same values for its
property variables. A property variable's value belongs only to the child object it's associated with.
Each property variable and its value persists as long as the child object exists. The initial value for
the property variable is typically set in the
To declare a property variable:
Use the
property
Lingo Dictionary.
To set and test property variables from outside the child object:
Set and test property variables in the same way you would any other property in Lingo, by
using the syntax
This statement sets the
car1.speed = 55
keyword at the beginning of the parent script. See
the propertyName of whichObject
property of the object
speed
handler; if it's not set, the initial value is
on new
or
whichObject.propertyName
:
car1
handler.
on new
in the
property
Writing Scripts with Lingo 419
.
VOID
.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Director mx

Table of Contents