3D Lingo Dictionary > O-S > registerForEvent() |
![]() ![]() ![]() |
registerForEvent()
Syntax
member(whichCastmember
).registerForEvent(eventName
,handlerName
,scriptObject
{
,begin, period
,repetitions
}
)
Description
3D command; declares the specified handler as the handler to be called when the specified event occurs within the specified cast member.
The following parameter descriptions apply to both the registerForEvent()
and the registerScript()
commands.
The handlerName
parameter is the name of the handler that will be called; this handler is found in the script object indicated by scriptObject
.
If 0 is specified for scriptObject
, then the first event handler with the given name found in a movie script is called.
The eventName
parameter can be any of the following predefined Lingo events, or any custom event that you define:
![]() |
|
![]() |
|
![]() |
|
For looping animations, the |
|
When a series of animations is queued for the model and the animation's |
|
![]() |
|
The handler you specify is sent the following arguments: |
|
|
|
|
|
|
|
|
|
|
Note: You can associate the registration of a script with a particular node rather than a cast member by using the registerScript()
command.
Examples
This statement registers the promptUser
event handler found in a movie script to be called twice at an interval of 5 seconds:
member("Scene").registerForEvent(#timeMS, #promptUser, 0,5000, 5000, 2)
This statement registers the promptUser
event handler found in a movie script to be called each time a collision occurs within the cast member named Scene:
member("Scene").registerForEvent(#collideAny, #promptUser, 0)
This statement declares the on promptUser
handler in the same script that contains the registerForEvent
command to be called when any object collides with the model named Pluto in the cast member named Scene:
member("Scene").registerForEvent(#collideWith, #promptUser, me, member("Scene").model("Pluto"))
See also
setCollisionCallback()
, registerScript()
, play()
, playNext()
, autoblend
, blendTime
, sendEvent
![]() ![]() ![]() |