Writing Scripts with Lingo
427
Basic debugging
Debugging involves strategy and analysis, not a standard step-by-step procedure. This section
describes the basic debugging approaches that programmers successfully use to debug any code,
not just Lingo.
Before you modify a movie significantly, always make a backup copy.
Identifying the problem
It might seem obvious, but the first thing to do when debugging is to identify the problem. Is a
button doing the wrong thing? Is the movie going to the wrong frame? Is a field not editable
when it should be?
If you copied the Lingo from another movie or from a written example, check whether the Lingo
was designed for some specific conditions. Perhaps it requires that a sprite channel is already
puppetted. Maybe cast member names must follow a specific style convention.
Locating the problem
Do the following to start locating a problem:
•
Think backwards through the chain to identify where the unexpected started to happen.
•
Use the Message window to trace which frames the movie goes through and the handlers
that Lingo runs.
•
Determine what the Lingo should be doing and consider what in these statements relates to the
problem. For example, if a text cast member isn’t editable when you expect it to be, where in
the movie does (or doesn’t) Lingo set the cast member’s
editable
property?
•
If a sprite doesn’t change as intended on the Stage, is the
updateStage
command needed
somewhere?
•
Does the problem occur only on certain computers and not others? Does it happen only when
the display is set to millions of colors? Maybe something in the computer is interfering with
the application.
You can focus on specific lines of Lingo by inserting a breakpoint—a point where Lingo pauses—
in a line. This gives you a chance to analyze conditions at that point before Lingo proceeds. For
information on how to insert breakpoints in a script, see “Using the Debugger window” on
page 435.
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...