clickOn
691
Example
This script checks to see if the sprite, which is specified with an ink effect of Background
Transparent, is currently set to be rendered direct to Stage. If the sprite is not rendered direct to
Stage, the sprite’s
clickMode
is set to
#opaque
. Otherwise (because ink effects are ignored for
Flash movie sprites that are rendered direct to Stage), the sprite’s
clickMode
is set to
#boundingBox
.
-- Lingo syntax
property spriteNum
on beginSprite me
if sprite(spriteNum).directToStage = FALSE then
sprite(spriteNum).clickMode = #opaque
else
sprite(spriteNum).clickMode = #boundingBox
end if
end
// JavaScript syntax
function beginSprite(me){
var dts = sprite(this.spriteNum).directToStage;
if (dts = 0) {
sprite(this.spriteNum).clickMode = symbol("opaque");
} else {
sprite(this.spriteNum).clickMode = symbol("boundingBox");
}
}
clickOn
Usage
-- Lingo syntax
_mouse.clickOn
// JavaScript syntax
_mouse.clickOn;
Description
Mouse property; returns the last active sprite clicked by the user. Read-only.
An active sprite is a sprite that has a sprite or cast member script associated with it.
When the user clicks the Stage,
clickOn
returns 0. To detect whether the user clicks a sprite
with no script, you must assign a mouse event script to it so that it can be detected by
clickOn
.
For example:
-- Lingo syntax
on mouseUp me
...
end
Buttons, check boxes, and radio buttons are detected by
clickOn
even if there is no script
attached to them.
The
clickOn
property can be checked within a loop. However, neither
clickOn
nor
clickLoc
change value when the handler is running. The value that you obtain is the value from before the
handler started.
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...