MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 59

Director scripting reference
Table of Contents

Advertisement

Creating a child object
Child objects exist entirely in memory; they are not saved with a movie. Only parent and ancestor
scripts exist on disk.
To create a new child object, you use the
name or position in a list so you can identify and work with it later.
To create a child object and assign it to a variable, use the following syntax.
-- Lingo syntax
variableName = new(script "scriptName", parameter1, parameter2, ...)
The
scriptName
are any parameters you are passing to the child object's
creates a child object whose ancestor is
object with the specified parameters.
You can issue a
new()
initial settings by changing the values of the parameters passed with the
Each child object requires only enough memory to record the current values of its properties and
variables and a reference to the parent script. Because of this, in most cases, you can create and
maintain as many child objects as you require.
You can produce additional child objects from the same parent script by issuing additional
statements.
new()
You can create child objects without immediately initializing their property variables by using the
method. The
rawNew()
the parent script's
allows you to create the objects ahead of time and defer the assignment of property
rawNew()
values until each object is needed.
The following statement creates a child object from the parent script Car without initializing its
property variables and assigns it to the variable
-- Lingo syntax
car1 = script("Car").rawNew()
To initialize the properties of one of these child objects, call its
car1.new
Checking child object properties
You can check the values of specific property variables in individual child objects by using a
simple
objectName
variable
the value of the
x
-- Lingo syntax
x = car1.carSpeed
Querying object properties from outside the objects themselves can be useful for getting
information about groups of objects, such as the average speed of all the car objects in a racing
game. You might also use the properties of one object to help determine the behavior of other
objects that are dependent on it.
parameter is the name of the parent script, and
scriptName
statement from anywhere in a movie. You can customize the child object's
method does this by creating the child object without calling
rawNew()
handler. In situations where large numbers of child objects are needed,
on new
.
syntax. For example, the following statement assigns the
propertyName
property of the child object in the variable
carSpeed
method and assign the child object a variable
new()
on new
. It then calls the
:
car1
on new
Object-oriented programming with Lingo
,
parameter1
parameter2
handler. The
method
new()
handler in the child
on new
statement.
new()
handler:
:
car1
,
...
59

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Director mx 2004

Table of Contents