When an event occurs, Director generates a message that describes the event. For example, when the user types at the keyboard, a movie stops, a sprite starts, or the playback head enters a frame, these actions are events and generate event messages.
Handlers contain groups of Lingo statements that run when a specific event occurs in a movie. Each handler begins with the word on followed by the message that the handler is set to respond to. The last line of the handler is the word end; you can repeat the handler's name after end, but this is optional.
For example, the mouseDown message indicates that the user clicked the mouse button. A handler that started with the line on mouseDown contains Lingo statements that run when the handler receives a mouseDown message. Whether the handler receives the message depends on which objects the handler is attached to in the movie.
Director contains handlers within scripts. Attach a set of handlers to an object by attaching the handlers' script to the object.