O'Reilly logo

Lingo in a Nutshell by Bruce A. Epstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Mouse Events

Mouse Events

Let’s explore Director’s sometimes counter-intuitive handling of mouse-related events. (See Chapter 2, for details on Director’s overall event handling and script creation.) This chapter is about understanding mouse event processing, not about creating buttons per se. Refer to Chapter 14, Graphical User Interface Components, in Director in a Nutshell for details on custom cursors and on creating well-behaved buttons and using the new Custom Button Editor Xtra. See also Example 4-6. “Manipulating Sprite Properties to Add Interactivity to a Button” in Chapter 4, CastLibs, Cast Members, and Sprites, in Director in a Nutshell.

Whenever the mouse button is pressed or released, Director generates mouseUp, mouseDown, rightMouseUp, or rightMouseDown events. Attach scripts with matching event handlers to turn the sprite into a clickable button.

Note that for simple linear presentations, the Tempo channel can be used to wait in a frame for a mouse click (or key press) before advancing the playback head. In prior versions of Director, the Tempo channel would ignore mouse events while waiting for time to elapse or for a sound or digital video to play. This limitation has been removed in Director 6 (although the Tempo channel doesn’t work in Shockwave).

Tip

The new mouseEnter, mouseLeave, and mouseWithin events are sent when the cursor enters or leaves a sprite with a corresponding handler attached (no mouse click is required). Leave the idleHandlerPeriod at its ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required