on enterFrame
169
Example
This handler runs when the playhead exits a sprite:
-- Lingo syntax
on endSprite me
-- clean up
gNumberOfSharks = gNumberOfSharks - 1
sound(5).stop()
end
// JavaScript syntax
function endSprite() {
// clean up
gNumberOfSharks--;
sound(5).stop();
}
See also
on beginSprite
,
on exitFrame
on enterFrame
Usage
-- Lingo syntax
on enterFrame
statement(s)
end
// JavaScript syntax
function enterFrame() {
statement(s);
}
Description
System message and event handler; contains statements that run each time the playhead enters
the frame.
Place
on enterFrame
handlers in behavior, frame, or movie scripts, as follows:
•
To assign the handler to an individual sprite, put the handler in a behavior attached to
the sprite.
•
To assign the handler to an individual frame, put the handler in the frame script.
•
To assign the handler to every frame (unless you explicitly instruct the movie otherwise), put
the
on enterFrame
handler in a movie script. The handler executes every time the playhead
enters a frame unless the frame script has its own handler. If the frame script has its own
handler, the
on enterFrame
handler in the frame script overrides the
on enterFrame
handler
in the movie script.
The order of frame events is
stepFrame
,
prepareFrame, enterFrame
, and
exitFrame
.
This event is passed the object reference
me
if used in a behavior.
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...