Lingo Dictionary > A-C > on beginSprite |
![]() ![]() ![]() |
on beginSprite
Syntax
on beginSprite
statement(s)
end
Description
System message and event handler; contains statements that run when the playback head 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 playback head loops on a frame, since the trigger is a sprite not previously encountered by the playback head. 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:
on beginSprite me puppetSound "Stevie Wonder" end
See also
on endSprite
, on prepareFrame
, scriptInstanceList
![]() ![]() ![]() |