Writing scripts in the Script window
73
You can also add properties to object instances after the instances have been created. When you
add a property to a specific object instance, that property is available only to that specific object
instance. Using the
myCar
object instance created previously, the following statements add the
color
property to
myCar
after it has already been created.
trace(myCar.color); // returns undefined
myCar.color = "blue"; // add the color property to the myCar instance
trace(myCar.color); // returns "blue"
var secondCar = new Car("Honda", "Accord"); // create a second object instance
trace(secondCar.color); // returns undefined
Writing scripts in the Script window
When you write scripts for a movie, the quantity and variety of scripts can be very large. Deciding
which methods or properties 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.
The best approach is to start simple and test your work frequently. When you get one part of a
script working, start writing the next part. This approach helps you identify bugs efficiently and
ensures that your scripts are solid as they become more complex.
When you write your scripts, you write them in the Script window in the Director user interface.
The Script window provides a number of features that help you create and modify your scripts.
To open the Script window, do one of the following:
•
Select Window > Script.
•
Double-click a script cast member in the Cast window.
For information on alternative ways to create and open scripts, see
“Performing common tasks”
on page 79
.
Содержание DIRECTOR MX 2004
Страница 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Страница 48: ...48 Chapter 2 Director Scripting Essentials...
Страница 100: ...100 Chapter 4 Debugging Scripts in Director...
Страница 118: ...118 Chapter 5 Director Core Objects...
Страница 594: ...594 Chapter 12 Methods...
Страница 684: ...684 Chapter 14 Properties See also DVD...
Страница 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Страница 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Страница 889: ...netPresent 889 _player alert Sorry the Network Support Xtras could not be found See also Player...
Страница 1102: ...1102 Chapter 14 Properties...