Lingo Dictionary > O-R > rollOver()

 

rollOver()

Syntax

rollOver(whichSprite)
the rollOver

Description

Function; indicates whether the cursor is currently over the bounding rectangle of the sprite specified by whichSprite (TRUE or 1) or not (FALSE or 0).

This function has two possible syntax formats:

When rollOver isn't preceded by the, include parentheses.

When rollOver is preceded by the, don't include parentheses.

The rollOver function is typically used in frame scripts and is useful for creating handlers that perform an action when the user places the cursor over a specific sprite. It can also simulate additional sprite channels by splitting the Stage into regions that each send the playback head to a different frame that subdivides the region for the available sprite channels.

If the user continues to roll the mouse, the value of rollOver can change while Lingo is running a handler. You can make sure that a handler uses a consistent rollover value by assigning rollOver to a variable when the handler starts.

When the cursor is over the location of a sprite that no longer appears in the Score in the current section, rollOver still occurs and reports the sprite as being there. Avoid this problem by not performing rollovers over these locations or by moving the sprite above the menu bar before removing it.

Example

This statement changes the content of the field cast member Message to "This is the place." when the cursor is over sprite 6:

if rollover(6) then member("Message").text = "This is the place.""

Example

This handler sends the playback head to different frames when the cursor is over certain sprites on the Stage. It first assigns the rollOver value to a variable. This lets the handler use the rollOver value that was in effect when the rollover started, regardless of whether the user continues to move the mouse.

on exitFrame
	set currentSprite = the rollover
	case currentSprite of
		1: go to frame "Left"
		2: go to frame "Middle"
		3: go to frame "Right"
	end case
end exitFrame

See also

mouseMember