379
Chapter 18: Controlling the 3D World
Adobe
®
Director
®
provides powerful methods for overall control of the three-dimensional (3D) world, including
Lingo and JavaScript™ syntax for handling new 3D-generated events, selecting models (picking), vector math opera-
tions, and transforms. In addition, the properties and methods of the Director global
rendererServices
object
supply common rendering properties for all 3D sprites and cast members. Finally, 3D cast member and sprite
properties and methods allow additional control of their content during playback.
The methods and properties that you see here in tabular form are also available with accompanying syntax, defini-
tions, and examples in the Scripting Reference topics in the Director Help Panel.
3D Lingo or JavaScript syntax events
Event handling lets you use the
registerForEvent
method to specify a handler to run when a particular event
occurs within a specific cast member. With the
registerForEvent
method, you specify the type of event that will
trigger the handler, the handler name, and the script object that contains the handler. The Lingo or JavaScript syntax
object can be a child script, an instance of a behavior attached to a sprite, or any other script. If the object isn’t
specified, the handler is called in the first movie script in which it is found.
Use the following methods to set up event handling:
Method
Description
Returns
registerForEvent
(
eventName
,
handlerName
,
scriptInstance
,
model
)
The event
eventName
is one of the following:
#collideAny
: Called when any collision occurs.
#collideWith
: Called when a collision with a specific model
occurs and implicitly registered when
setCollisionCallback(...)
is called. Equivalent to
calling
model.collision.setCollision
Callback
.
#timeMS
: Sets up a time-based simulation callback using the
format
registerForEvent
(
timeMS
,
handlerName
,
scriptInstance
)
begin
,
period
,
repetitions
.
The
begin
and
period
arguments are in milliseconds. If
repetitions
is set to
0
, the simulation continues indefi-
nitely.
#animationStarted
: Called whenever a keyFrame or bones
motion begins.
#animationEnded
: Called whenever a keyFrame or bones
motion ends.
Any user-defined symbol: Registers to receive any user-defined
event sent from a
SendEvent
call.
TRUE (1)
if the operation
succeeds.
FALSE (0)
if the operation
fails.
unregister
AllEvents()_
Unregisters all events.
Nothing.
A script error is generated if
the operation fails.