Chapter 14
370
For example, this handler sends the custom message
bumpCounter
and the argument 2 to sprite 1
when the user clicks the mouse:
on mouseDown me
sendSprite (1, #bumpCounter, 2)
end
Note:
The symbol (
#
) operator must precede the message in the
sendSprite
command.
Sending messages to all sprites
The
sendAllSprites
command sends a message to every sprite in the frame. If no behavior of
the specified sprite has a handler that corresponds to the message, the message passes to the cast
member script, the frame script, and then the movie script. See
sendAllSprites
in the
Lingo Dictionary.
For example, this handler sends the custom message
bumpCounter
and the argument 2 to all
sprites in the frame when the user clicks the mouse button:
on mouseDown me
sendAllSprites (#bumpCounter, 2)
end
Note:
The symbol (
#
) operator must precede the message in the
sendAllSprites
command.
Sending messages to specific behaviors only
The
call
command sends an event to specific behaviors. Unlike the
sendSprite
command,
the
call
command doesn’t pass the message to frame scripts, scripts of the cast member, or
movie scripts.
Before sending a message to a specific behavior, check the
scriptInstanceList
sprite property
to find a behavior script reference to use with the
call
command.
The
scriptInstanceList
property provides a list of references for the behaviors attached to a
sprite while a movie is playing.
For example, this handler displays the list of references for all behaviors attached to the same
sprite as this behavior’s handler:
on showScriptRefs me
put the scriptInstanceList of sprite the ¬
spriteNum of me
end
This handler sends the message
bumpCounter
to the first script reference attached to sprite 1 (the
getAt
function identifies the first script reference in the
scriptInstanceList
):
on mouseDown me
xref = getAt (the scriptInstanceList of sprite 1,1)
call (#bumpCounter, xref, 2)
end
Note:
The symbol (
#
) operator must precede the message in the
call
command.
To remove instances of a sprite while the movie is playing:
•
Set the sprite’s
scriptInstanceList
property to an empty list([]). See
scriptInstanceList
in the Lingo Dictionary.
Содержание 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...