• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 17. Scripting Lingo > Setting Up Primary Event Handlers

Setting Up Primary Event Handlers

Primary event handlers provide the first opportunity for your movie to respond to messages. They are first in the hierarchy of objects that messages are sent to. Table 17.2 contains some of the Lingo properties you use in defining a primary event handler, as well as their corresponding messages. Only a subset of Director's built-in messages can work with a primary event handler. The Lingo Dictionary includes the complete list of the messages.

To set up a primary event handler:

Open a movie script.

Create a startMovie handler.

This handler generally is the best place to define a primary event handler.

In the middle of the handler, type set the "property" to "your script".

Replace property with the primary event-handler property corresponding to the message you want to trap, and replace your script with the actual script statement in quotes that you want to execute. (You could also place a custom handler name here.)

In the example (Figure 17.57), the mouseDownScript has been set to move the playback head to frame 5. So every time someone clicks the mouse button in the movie, the movie loops back to frame 5, and the mouseDown message does not continue on to other scripts (unless you include the Pass command in the primary event handler's script response).

Figure 17.57. This script defines a primary event handler to trap a mouseDown message.

Close the Script window and run the movie to test the script.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint