EasyManua.ls Logo

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING - Page 691

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING
1130 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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.