Writing Scripts with Lingo
433
•
Check variables and expressions. Analyze how their values change as the movie plays. See if
they change at the wrong time or don’t change at all. If the same variable is used in more than
one handler, make sure that each handler that uses the variable states that the variable is global.
You can track the values of variables and expressions by displaying their values in the Watcher
pane or the Object inspector.
•
Make changes one at a time. Don’t be afraid to change things in a handler to see if the change
eliminates the problem or gives some result that helps point to the problem.
However, don’t trade one problem for another. Change things one at a time and change them
back if the problem isn’t fixed. If you introduce too many changes before solving a problem,
you might not determine what the original problem was and you might even introduce
new problems.
•
Re-create the section. If you haven’t found the problem, try re-creating the section from
scratch. For example, if rolling the pointer over a sprite doesn’t make the sprite behave the
way you want, create a simple movie that contains just the sprite and handler with the
rollover
statement.
Don’t just copy and paste scripts; that might just copy the problem. Re-creating the section lets
you reconstruct the logic at its most basic level and verify that Director is working as you
expect. If the section that you re-create still doesn’t work properly, chances are that there is
something wrong in the logic for the section.
If the section that you re-create works properly, compare that section to the original movie to
see where the two differ. You can also copy the section into the original piece and see whether
this corrects the problem.
Using the Object inspector
With the Object inspector, you can view and set properties of many kinds of objects that are not
displayed in the Property inspector. These include Lingo objects such as global variables, lists,
child objects from parent scripts, all 3D cast member properties, sprite properties, Lingo
expressions, and so on. In addition, the Object inspector displays changes to object properties
that occur while a movie plays, such as changes due to Lingo scripts or changes to sprite
Score properties. These kinds of changes are not displayed in the Property inspector during
movie playback.
The Object inspector can be very useful for understanding the structure of complex objects. For
example, 3D cast members have many layers of properties. Because the Object inspector shows
you a visual representation of the nested structure of those properties, it makes it much easier to
become familiar with them and their relationships to each other. Understanding the property
structure of objects in Director is important when writing Lingo scripts.
The ability to watch the values of properties change while a movie plays is helpful for
understanding what is happening in the movie. It is especially helpful when testing and
debugging Lingo scripts, because you can watch as the values change based on scripts
you’ve written.
The Director Debugger window displays this information also, but is only available when you
are in debugging mode. For more information about debugging, see “Advanced debugging”
on page 432.
There are 2 ways to view an object in the Object inspector. You can drag items directly into the
Object inspector or enter the name of an item into the Object inspector manually.
Содержание DIRECTOR MX-USING 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...