Chapter 16
428
Solving simple problems
When finding a bug, it’s a good idea to check for simple problems first.
The first debugging test occurs when you close the Script window. Director gives you an error
message if the script contains incorrect syntax when you close the Script window. The message
usually includes the line in which the problem was first detected. A question mark appears at the
spot in the line where Director first found the problem.
For example, the message “String does not end correctly” tells you that the problem relates to the
string in the line
go to Interact
. The only string in this line is Interact, which is the name of a
marker. After thinking about syntax for strings, you’ll see that the problem is that no beginning
quotation mark precedes Interact.
Syntax errors are probably the most common bug in Lingo. When a script fails, it is a good idea to
first make sure that:
•
Terms are spelled correctly, spaces are in the correct places, and necessary punctuation is used.
Lingo can’t interpret incorrect syntax.
•
Quotation marks surround the names of cast members, labels, and strings within
the statement.
•
All necessary parameters are present. The specific parameters depend on the individual
element. See the Lingo Dictionary to determine any additional parameters an element requires.
If the Script window closes without an error message, the script might contain a bug. If Lingo isn’t
doing what you want, check that:
•
Values for parameters are correct. For example, using an incorrect value for the number of
beeps that you want the
beep
command to generate gives you the wrong number of beeps.
•
Values that change—such as variables and the content of text cast members—have the values
you want. You can display their values in the Object inspector by selecting the name of the
object and clicking Inspect Object in the Script window, or in the Message window by using
the
put
command.
•
The Lingo elements do what you think they do. You can check their behavior by referring to
the Lingo Dictionary.
Содержание Director MX
Страница 1: ...Using Director MX Macromedia Director MX ...
Страница 12: ...Contents 12 ...
Страница 156: ...Chapter 4 156 ...
Страница 202: ...Chapter 6 202 ...
Страница 244: ...Chapter 7 244 ...
Страница 292: ...Chapter 10 292 ...
Страница 330: ...Chapter 12 330 ...
Страница 356: ...Chapter 13 356 ...
Страница 372: ...Chapter 14 372 ...
Страница 442: ...Chapter 16 442 ...
Страница 472: ...Chapter 18 472 ...
Страница 520: ...Chapter 19 520 ...
Страница 536: ...Chapter 20 536 ...
Страница 562: ...Chapter 23 562 ...
Страница 566: ...Chapter 24 566 ...
Страница 602: ...Chapter 27 602 ...