EasyManua.ls Logo

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING - Page 183

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...
on mouseEnter 183
on mouseEnter
Usage
-- Lingo syntax
on mouseEnter
statement(s)
end
// JavaScript syntax
function mouseEnter() {
statement(s);
}
Description
System message and event handler; contains statements that run when the mouse pointer first
contacts the active area of the sprite. The mouse button does not have to be pressed.
If the sprite is a bitmap cast member with matte ink applied, the active area is the portion of the
image that is displayed; otherwise, the active area is the sprites bounding rectangle.
If used in a behavior, this event is passed the sprite script or frame script reference
me.
Example
This example is a simple button behavior that switches the bitmap of the button when the mouse
rolls over and then off the button:
-- Lingo syntax
property spriteNum
on mouseEnter me
-- Determine current cast member and switch to next in cast
currentMember = sprite(spriteNum).member.number
sprite(spriteNum).member = currentMember + 1
end
on mouseLeave me
-- Determine current cast member and switch to previous in cast
currentMember = sprite(spriteNum).member.number
sprite(spriteNum).member = currentMember - 1
end
// JavaScript syntax
var spriteNum;
function mouseEnter() {
// Determine current cast member and switch to next in cast
currentMember = sprite(spriteNum).member.number;
sprite(spriteNum).member = currentMember + 1;
}
function mouseLeave() {
// Determine current cast member and switch to previous in cast
currentMember = sprite(spriteNum).member.number;
sprite(spriteNum).member = currentMember - 1;
}
See also
on mouseLeave, on mouseWithin

Related product manuals