512
Chapter 12: Methods
Example
The following frame script checks whether the Flash movie sprite in the sprite the behavior was
placed in is playing and, if so, continues to loop in the current frame. When the movie is finished,
the sprite rewinds the movie (so the first frame of the movie appears on the Stage) and lets the
playhead continue to the next frame.
-- Lingo syntax
property spriteNum
on exitFrame
if sprite(spriteNum).playing then
_movie.go(_movie.frame)
else
sprite(spriteNum).rewind()
_movie.updatestage()
end if
end
// JavaScript syntax
function exitFrame() {
var plg = sprite(this.spriteNum).playing;
if (plg = 1) {
_movie.go(_movie.frame);
} else {
sprite(this.spriteNum).rewind();
_movie.updatestage();
}
}
rollOver()
Usage
-- Lingo syntax
_movie.rollOver({
intSpriteNum
})
// JavaScript syntax
_movie.rollOver({
intSpriteNum
});
Description
Movie method; indicates whether the pointer (cursor) is currently over the bounding rectangle of
a specified sprite (
TRUE
or 1) or not (
FALSE
or 0).
The
rollOver()
method is typically used in frame scripts and is useful for creating handlers that
perform an action when the user places the pointer over a specific sprite.
If the user continues to roll the mouse, the value of
rollOver()
can change while a script is
running a handler, and can result in unexpected behavior. You can make sure that a handler uses a
consistent rollover value by assigning
rollOver()
to a variable when the handler starts.
When the pointer is over an area of the Stage where a sprite previously appeared,
rollOver()
still
occurs and reports the sprite as still being there. Avoid this behavior by not performing rollovers
over these locations, or by moving the sprite above the menu bar before removing it.
Parameters
intSpriteNum
Optional. An integer that specifies the sprite number.
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
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...