MACROMEDIA DIRECTOR MX-USING DIRECTOR MX Use Manual page 422

Table of Contents

Advertisement

Checking child object properties
You can check the values of specific property variables in individual child objects by using a
simple
objectName.PropertyName
value of the
carSpeed
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.
In addition to checking the properties you assign, you can check whether a child object contains a
specific handler or find out which parent script an object came from. This is useful when you
have objects that come from parent scripts that are similar but that have subtle differences.
For example, you may want to create a scenario in which one of several parent scripts might be
used to create a child object. You can then determine which parent script a particular child object
came from by using the
These statements check whether the object
if car1.script = script("Car") then
beep
end if
You can also get a list of the handlers in a child object by using the
check whether a particular handler exists in a child object by using the
This statement places a list of the handlers in the child object
:
myHandlerList
myHandlerList = car1.handlers()
The list would look something like this:
[#start, #accelerate, #stop]
These statements use the
exists in the child object
if car1.handler(#accelerate) then
put "The child object car1 contains the handler named on accelerate."
end if
Removing a child object
You can remove a child object from a movie by setting all variables that contain a reference to the
child object to another value. If the child object has been assigned to a list, such as
you must also remove the child object from the list. (The
tracking and manipulating the child objects in a movie. For details, see "Using actorList"
on page 423.)
To remove a child object and the variables that refer to it:
Set each variable to
Director deletes the child object when there are no more references to it. For example, if
contains the only reference to a specific child object, then the
deletes the object from memory.
422
Chapter 16
syntax. For example, this statement assigns the variable
property of the child object in the variable
function, which returns the name of an object's parent script.
script()
car1
function to check whether the handler
handler()
:
car1
.
VOID
:
car1
was created from the parent script named Car:
handlers()
handler()
into the variable
car1
property is useful for
actorList
statement set ball1 = VOID
the
x
function, or
function.
on accelerate
,
actorList
ball1

Advertisement

Table of Contents
loading

This manual is also suitable for:

Director mx

Table of Contents