Director MX Basics Tutorial
89
Each script you write is composed of handlers. A handler is a set of Lingo commands that handle
a specific event, such as the
exitFrame
event. Some scripts have only one handler and some have
multiple handlers. Each handler begins with the name of the triggering event, such as
exitFrame
,
and ends with the word
end
.
Write a handler
In this section, you’ll write a simple handler. The following discussion describes the script.
1
Open the Score (Window > Score) if it is not already open.
2
In the script channel, double-click frame 10, the last frame of the start scene. The Script
window opens, and it already includes a default handler:
on exitFrame me
end
3
In between these two lines of text, enter:
go to the frame
The result is a handler that appears as shown in the following figure:
4
Close the Script window. The new script cast member appears in the Cast window in slot 13. A
sprite for the script also appears in the script channel in frame 10.
5
In the Cast window, select the new script and type
Loop
in the Cast Member Name text box at
the top of the window. Press Enter (Windows) or Return (Macintosh).
6
Rewind and play your movie. The movie plays to frame 10 and stops. The movie still plays,
even though it stops at frame 10. Stop the movie.
The handler you’ve written has three parts. The first line,
on exitFrame me
, tells Director to run
this script when the playhead leaves the frame where the script is located. This is frame 10. You
don’t need to worry about the word
me
that appears on this line. You’ll only edit it when writing
advanced Lingo scripts.
The second line contains the
go to the frame
command, which tells Director to send the
playhead back to the current frame. The phrase
the frame
always refers to the frame number
where the playhead is currently located. Again, this is frame 10.
The last line of any handler contains the word
end
. This simply signals to Director the end of the
script. The result is that the playhead continually loops in frame 10 as it is sent back to frame 10
each time it tries to go to frame 11. This way your Director movie plays to frame 10 and loops
there until the user clicks a button to go to a different scene.
Summary of Contents for DIRECTOR MX-USING DIRECTOR MX
Page 1: ...Using Director MX Macromedia Director MX...
Page 12: ...Contents 12...
Page 156: ...Chapter 4 156...
Page 202: ...Chapter 6 202...
Page 244: ...Chapter 7 244...
Page 292: ...Chapter 10 292...
Page 330: ...Chapter 12 330...
Page 356: ...Chapter 13 356...
Page 372: ...Chapter 14 372...
Page 442: ...Chapter 16 442...
Page 472: ...Chapter 18 472...
Page 520: ...Chapter 19 520...
Page 536: ...Chapter 20 536...
Page 562: ...Chapter 23 562...
Page 566: ...Chapter 24 566...
Page 602: ...Chapter 27 602...