
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
410
|
Chapter 16: ActionScript Authoring Environment
Normally, variable initialization occurs in the source code of a movie clip. For exam-
ple, here we set up the variables used to control a fireworks effect:
// User-defined variables
this.numSparks = 10; // Number of spark clips in the explosion
this.randomDispersion = true; // Explosion style (true for random,
// false for uniform)
this.duration = 1300; // Length of explosion, in milliseconds
Modifying source code of this sort can be intimidating for nonprogrammers. But if
we build our code into a component, nonprogrammers can configure the fireworks
effect through a familiar application-style interface in the Property inspector.
Figure 16-2 shows a component interface equivalent to our variable-initialization
code.
In a component interface, each variable appears with its name and value clearly dis-
tinguished in separate rows and columns. Variable names cannot be edited, so
there’s no chance of inadvertent typographical errors breaking the system. Each vari-
able also has its own verbose name explaining more plainly what it does. Finally,
variables with a limited set of legal values (such as
randomDispersion) can be assigned
via drop-down menus.
For nonprogrammers, the interface shown in Figure 16-2 is certainly more approach-
able than ...