Chapter 16
386
Parent scripts
are special scripts that contain Lingo used to create child objects. You can use
parent scripts to generate script objects that behave and respond similarly yet can still operate
independently of each other. A parent script icon appears in the lower right corner of the Cast
window thumbnail.
For information about parent scripts, see “Using parent scripts and child objects” on page 417.
Scripts attached to cast members
are attached directly to a cast member, independent of the
Score. Whenever the cast member is assigned to a sprite, the cast member’s script is available.
Unlike behaviors, movie scripts, and parent scripts, cast member scripts don’t appear in the Cast
window. However, if Show Cast Member Script Icons is selected in the Cast Window Preferences
dialog box, cast members that have a script attached display a small script icon in the lower left
corner of their thumbnails in the Cast window.
How scripts flow
Director always executes Lingo statements starting with the first statement and continuing in
order until it reaches the final statement or a statement that instructs Lingo to go somewhere else.
To set up statements so that they run when specific conditions exist, you use
if...then
,
case
,
and
repeat
loop structures. For example, you can create an
if...then
structure that tests
whether text has finished downloading from the Internet and, if it has, then attempts to format
the text. See “Controlling flow in scripts” on page 410.
The order in which statements are executed affects the order in which you should place
statements. For example, if you write a statement that requires some calculated value, you need to
put the statement that calculates the value first. For instance, in the following example, the first
statement adds two numbers, and the second assigns a string representation of the sum to a field
cast member to be displayed on the Stage:
x = 2 + 2
put string(x) into member "The Answer"
About planning and debugging scripts
When you write scripts for an entire movie, the quantity and variety of scripts can be very large.
Deciding which Lingo commands to use, how to structure scripts effectively, and where scripts
should be placed requires careful planning and testing, especially as the complexity of your movie
grows.
Before you begin writing scripts, formulate your goal and understand what you want to
achieve. This is as important—and typically as time consuming—as developing storyboards
for your work.
When you have an overall plan for the movie, you are ready to start writing and testing scripts.
Expect this to take time. Getting scripts to work the way you want often takes more than one
cycle of writing, testing, and debugging.
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...