on beginSprite
161
See also
activeWindow
,
close()
,
on deactivateWindow
,
frontWindow
,
on moveWindow
,
open()
(Window)
on beginSprite
Usage
-- Lingo syntax
on beginSprite
statement(s)
end
// JavaScript syntax
function beginSprite() {
statement(s);
}
Description
System message and event handler; contains statements that run when the playhead moves to a
frame that contains a sprite that was not previously encountered. Like
endSprite
, this event is
generated only one time, even if the playhead loops on a frame, since the trigger is a sprite not
previously encountered by the playhead. The event is generated before
prepareFrame
.
Director creates instances of any behavior scripts attached to the sprite when the
beginSprite
message is sent.
The object reference
me
is passed to this event if it is used in a behavior. The message is sent to
behaviors and frame scripts.
If a sprite begins in the first frame that plays in the movie, the
beginSprite
message is sent after
the
prepareMovie
message but before the
prepareFrame
and
startMovie
messages.
Note:
Be aware that some sprite properties, such as the
rect
sprite property, may not be accessible
in a beginSprite handler. This is because the property needs to be calculated, which is not done until
the sprite is drawn.
The
go
,
play
, and
updateStage
commands are disabled in an
on beginSprite
handler.
Example
This handler plays the sound cast member Stevie Wonder when the sprite begins:
-- Lingo syntax
on beginSprite me
sound(1).play(member("Stevie Wonder"))
end
// JavaScript syntax
function beginSprite() {
sound(1).play(member("Stevie Wonder"));
}
See also
on endSprite
,
on prepareFrame
,
scriptInstanceList
Summary of Contents for DIRECTOR MX 2004
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...