Chapter 9. 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
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).
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 ...