Chapter 20
522
Use these commands to set up event handling:
Collisions
By attaching the collision modifier (
#collision
) to a model, you can enable that model to
automatically respond to collisions with other models. By using the properties of the collision
modifier, you can control the details of how the model responds to collisions. For more
information on collisions, see “Modifiers” on page 498.
Collision properties
When a collision occurs, it generates a
collideWith
event.The
collideWith
event passes an
argument to the handler that is declared with the
registerForEvent
or
setCollisionCallBack
command. This argument is called a
collisionData
object and
contains a property list with detailed information about the collision.
These properties are included in the
collisionData
object passed to the handler:
Command
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
indefinitely.
#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 Lingo error is generated
if the operation fails.
sendEvent
(
eventName
,
arg1
,
arg2...
)
Sends an event named
eventName
to all scripts registered
to receive it.
Similar to
sendAllSprites()
except that the event is
delivered only to scripts that are registered to receive it.
Nothing.
A Lingo error is generated
if the operation fails.
Property
Access
Description
modelA
Get
One model in the collision.
If the Lingo script includes registration for collision with a
particular model,
modelA
is that model.
modelB
Get
The second model in the collision.
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...