| About the Authors |
|
xiii | |
| About the Cover Image Designer |
|
xv | |
| Introduction |
|
xvii | |
|
|
|
1 | (28) |
|
Giving your movies instructions |
|
|
2 | (1) |
|
Working with the Actions panel |
|
|
3 | (4) |
|
|
|
7 | (5) |
|
|
|
12 | (6) |
|
Controlling movie clips on the stage |
|
|
12 | (6) |
|
|
|
18 | (2) |
|
Listening to what your movies are telling you |
|
|
20 | (2) |
|
|
|
20 | (1) |
|
|
|
21 | (1) |
|
|
|
21 | (1) |
|
Introducing event handlers |
|
|
22 | (5) |
|
|
|
22 | (3) |
|
Animating movie clips with ActionScript |
|
|
25 | (2) |
|
|
|
27 | (2) |
|
|
|
29 | (30) |
|
|
|
30 | (6) |
|
Keep your ideas in a safer place than your head |
|
|
32 | (1) |
|
|
|
33 | (3) |
|
Building your ActionScript |
|
|
36 | (8) |
|
Thinking from the top down |
|
|
36 | (2) |
|
Thinking from the bottom up |
|
|
38 | (3) |
|
|
|
41 | (3) |
|
Book project: Introducing the Futuremedia site |
|
|
44 | (12) |
|
|
|
49 | (1) |
|
|
|
50 | (4) |
|
|
|
54 | (2) |
|
|
|
56 | (1) |
|
|
|
56 | (3) |
|
|
|
59 | (46) |
|
|
|
61 | (23) |
|
|
|
62 | (1) |
|
Creating variables and using them with literals and expressions |
|
|
63 | (1) |
|
|
|
63 | (2) |
|
|
|
65 | (1) |
|
|
|
66 | (1) |
|
|
|
67 | (5) |
|
|
|
72 | (6) |
|
|
|
78 | (1) |
|
|
|
79 | (2) |
|
Other uses for numeric expressions |
|
|
81 | (1) |
|
Working with Boolean values |
|
|
82 | (1) |
|
|
|
83 | (1) |
|
|
|
84 | (8) |
|
|
|
86 | (1) |
|
Arrays let you store related information together |
|
|
86 | (1) |
|
Arrays let you hold information in a specific order |
|
|
86 | (1) |
|
Arrays let you index information |
|
|
87 | (1) |
|
Arrays let you link information |
|
|
87 | (1) |
|
|
|
87 | (2) |
|
|
|
89 | (1) |
|
Using variable values as offsets |
|
|
89 | (3) |
|
Book project: Starting the Futuremedia site design |
|
|
92 | (11) |
|
|
|
92 | (1) |
|
What you're going to learn |
|
|
93 | (1) |
|
Choosing and setting the stage size |
|
|
93 | (1) |
|
|
|
94 | (1) |
|
|
|
95 | (2) |
|
Adding the position and status text |
|
|
97 | (1) |
|
|
|
98 | (1) |
|
|
|
98 | (3) |
|
|
|
101 | (1) |
|
|
|
102 | (1) |
|
|
|
103 | (2) |
|
Movies That Decide for Themselves |
|
|
105 | (34) |
|
|
|
106 | (11) |
|
Making decisions in ActionScript: The if action |
|
|
107 | (3) |
|
|
|
110 | (7) |
|
|
|
117 | (19) |
|
Acting on alternatives: The else action |
|
|
118 | (1) |
|
More than one alternative: The else if action |
|
|
119 | (4) |
|
Handling lots of alternatives: The switch action |
|
|
123 | (3) |
|
|
|
126 | (10) |
|
Organizing your code in the correct order |
|
|
136 | (1) |
|
|
|
136 | (3) |
|
|
|
139 | (46) |
|
|
|
140 | (1) |
|
|
|
141 | (1) |
|
|
|
141 | (14) |
|
Useful things to do with while loops |
|
|
142 | (10) |
|
|
|
152 | (1) |
|
|
|
153 | (1) |
|
|
|
153 | (1) |
|
|
|
153 | (1) |
|
Some useful examples of for loops |
|
|
154 | (1) |
|
|
|
154 | (1) |
|
|
|
154 | (1) |
|
|
|
154 | (1) |
|
Looping through elements in an array |
|
|
155 | (3) |
|
Applying an operation to all the elements in an array |
|
|
155 | (1) |
|
Searching an array for a specific value |
|
|
156 | (1) |
|
Cross-indexing a pair of arrays |
|
|
157 | (1) |
|
|
|
158 | (14) |
|
Book project: Creating the static graphics |
|
|
172 | (9) |
|
Setting up the timeline layers for your graphics |
|
|
174 | (1) |
|
|
|
174 | (2) |
|
Adding structure to the Library |
|
|
176 | (2) |
|
Creating the frame cutout |
|
|
178 | (2) |
|
Revealing the frame cutout and finishing the FLA |
|
|
180 | (1) |
|
|
|
180 | (1) |
|
|
|
181 | (4) |
|
Movies That Remember How to Do Things |
|
|
185 | (36) |
|
|
|
186 | (1) |
|
Bundling actions and running them afterward |
|
|
187 | (5) |
|
Using anonymous and named functions |
|
|
187 | (1) |
|
Using functions to hide evil math |
|
|
188 | (3) |
|
Using functions to take care of repetitive jobs |
|
|
191 | (1) |
|
Choosing which actions to bundle and where |
|
|
192 | (15) |
|
|
|
194 | (1) |
|
Local variables and modular code |
|
|
195 | (3) |
|
Returning values from a function |
|
|
198 | (2) |
|
|
|
200 | (2) |
|
|
|
202 | (5) |
|
|
|
207 | (6) |
|
|
|
208 | (2) |
|
Using more function nesting to tidy up your script |
|
|
210 | (3) |
|
Book project: Creating the dynamic graphics |
|
|
213 | (5) |
|
|
|
218 | (3) |
|
|
|
221 | (48) |
|
Introducing objects and classes |
|
|
222 | (7) |
|
Type and object-oriented programming |
|
|
224 | (1) |
|
Classes, generalization, and abstraction |
|
|
224 | (1) |
|
Seeing arrays in a new light |
|
|
225 | (1) |
|
The Array constructor method |
|
|
225 | (2) |
|
|
|
227 | (2) |
|
|
|
229 | (1) |
|
Creating classes and objects (instances) in Flash |
|
|
229 | (7) |
|
|
|
230 | (1) |
|
|
|
230 | (1) |
|
Viewing an object in Flash |
|
|
231 | (1) |
|
|
|
232 | (4) |
|
Objects, objects, everywhere |
|
|
236 | (20) |
|
|
|
236 | (2) |
|
|
|
238 | (18) |
|
Book project: Initializing the code |
|
|
256 | (11) |
|
Getting yourself comfortable |
|
|
257 | (2) |
|
Initializing the site variables |
|
|
259 | (1) |
|
Telling ActionScript about the stage |
|
|
260 | (3) |
|
|
|
263 | (1) |
|
Setting up your tricolor colors |
|
|
264 | (1) |
|
|
|
265 | (2) |
|
|
|
267 | (1) |
|
|
|
267 | (2) |
|
|
|
269 | (30) |
|
Movie clips and buttons as objects |
|
|
270 | (4) |
|
Symbol types and behaviors |
|
|
273 | (1) |
|
Two sides of the same object |
|
|
273 | (1) |
|
Working with Library items |
|
|
274 | (5) |
|
|
|
279 | (2) |
|
|
|
281 | (2) |
|
The other side of bitmap caching |
|
|
283 | (4) |
|
|
|
284 | (1) |
|
Changing the appearance of a cached movie clip |
|
|
285 | (2) |
|
When to use bitmap caching |
|
|
287 | (1) |
|
Referencing different timelines with ActionScript |
|
|
287 | (6) |
|
Different place, different variable |
|
|
287 | (1) |
|
Locating variables from inside an event handler function |
|
|
288 | (1) |
|
Reusing handler functions |
|
|
289 | (4) |
|
|
|
293 | (2) |
|
|
|
295 | (1) |
|
|
|
296 | (3) |
|
Reusable Code and Realistic Movement |
|
|
299 | (52) |
|
Breaking down big tasks into smaller ones |
|
|
300 | (2) |
|
|
|
301 | (1) |
|
Creating simple components |
|
|
302 | (12) |
|
Creating a modular set of playback controls |
|
|
303 | (8) |
|
|
|
311 | (3) |
|
Modular control of movie clips |
|
|
314 | (5) |
|
How to simulate realistic movement |
|
|
314 | (2) |
|
|
|
316 | (3) |
|
Trailing the pointer (a mouse follower) |
|
|
319 | (8) |
|
Understanding the inertial code |
|
|
324 | (1) |
|
Fine-tuning the component |
|
|
325 | (2) |
|
Function-based modular code |
|
|
327 | (5) |
|
|
|
328 | (4) |
|
Taking the swarming effect forward |
|
|
332 | (1) |
|
Creating tweens with ActionScript |
|
|
332 | (6) |
|
Using import to access the Tween class |
|
|
333 | (1) |
|
How to use the Tween constructor function |
|
|
334 | (1) |
|
Understanding the transition types |
|
|
335 | (3) |
|
Book project: Setting up the color transition |
|
|
338 | (10) |
|
|
|
338 | (2) |
|
|
|
340 | (4) |
|
|
|
344 | (2) |
|
Running the FLA: The results |
|
|
346 | (1) |
|
|
|
347 | (1) |
|
|
|
348 | (3) |
|
|
|
351 | (58) |
|
|
|
352 | (1) |
|
|
|
353 | (5) |
|
External and internal data |
|
|
353 | (5) |
|
|
|
358 | (1) |
|
|
|
358 | (9) |
|
|
|
365 | (2) |
|
The game world (the main timeline) |
|
|
367 | (4) |
|
gSCREEN_TOP, gSCREEN_BOTTOM, gSCREEN_RIGHT, and gSCREEN_LEFT |
|
|
368 | (1) |
|
|
|
368 | (1) |
|
|
|
368 | (1) |
|
|
|
368 | (1) |
|
shipDead, fired, and gSHIP_HEIGHT |
|
|
368 | (1) |
|
|
|
369 | (2) |
|
|
|
371 | (19) |
|
|
|
371 | (2) |
|
The ``start game'' trigger |
|
|
373 | (3) |
|
|
|
376 | (4) |
|
|
|
380 | (1) |
|
|
|
381 | (1) |
|
|
|
381 | (1) |
|
|
|
381 | (1) |
|
|
|
382 | (1) |
|
|
|
383 | (4) |
|
|
|
387 | (2) |
|
|
|
389 | (1) |
|
Book project: Navigation event handling |
|
|
390 | (17) |
|
|
|
391 | (1) |
|
Adding the basic Ul animation |
|
|
391 | (5) |
|
navigate() and posTransition() |
|
|
396 | (4) |
|
|
|
400 | (1) |
|
|
|
400 | (1) |
|
Creating a smooth transition |
|
|
400 | (6) |
|
|
|
406 | (1) |
|
|
|
407 | (2) |
|
|
|
409 | (44) |
|
|
|
410 | (1) |
|
|
|
411 | (5) |
|
|
|
416 | (6) |
|
How the sketching code works |
|
|
421 | (1) |
|
|
|
422 | (3) |
|
|
|
425 | (10) |
|
|
|
426 | (1) |
|
Building the kaleidoscope engine |
|
|
427 | (8) |
|
Book project: Color transition event handling and data |
|
|
435 | (16) |
|
Wiring the colTransition() function |
|
|
435 | (1) |
|
|
|
436 | (1) |
|
|
|
437 | (1) |
|
Coding the color transition |
|
|
438 | (2) |
|
Finishing the text transition |
|
|
440 | (1) |
|
Reviewing the code so far |
|
|
441 | (1) |
|
Data-driven sites (and why you need to understand them) |
|
|
442 | (2) |
|
Defining data for Futuremedia |
|
|
444 | (6) |
|
|
|
450 | (1) |
|
|
|
451 | (2) |
|
|
|
453 | (34) |
|
Choosing the right sound format |
|
|
454 | (1) |
|
Using sound on a timeline |
|
|
455 | (3) |
|
Using the ActionScript Sound class |
|
|
458 | (18) |
|
Playing sounds from ActionScript |
|
|
458 | (1) |
|
Attaching sounds to a sound instance |
|
|
458 | (4) |
|
Starting and stopping sounds |
|
|
462 | (2) |
|
Creating dynamic soundtracks |
|
|
464 | (5) |
|
Using ActionScript to control volume and balance |
|
|
469 | (7) |
|
Dealing with large sound files |
|
|
476 | (7) |
|
Using compression to reduce download times |
|
|
476 | (2) |
|
Loading sound from external files |
|
|
478 | (5) |
|
Silence can also be golden |
|
|
483 | (2) |
|
|
|
485 | (2) |
|
Loading Dynamic Data with XML |
|
|
487 | (38) |
|
|
|
488 | (9) |
|
How an XML document is structured |
|
|
490 | (2) |
|
Using the right version and encoding |
|
|
492 | (1) |
|
Using non-English text with XML in Flash |
|
|
492 | (2) |
|
Saving XML files in UTF-8 |
|
|
494 | (2) |
|
|
|
496 | (1) |
|
Checking that your document is well formed |
|
|
496 | (1) |
|
|
|
497 | (6) |
|
Book project: Controlling structure and content with XML |
|
|
503 | (19) |
|
Building the basic XML structure |
|
|
503 | (5) |
|
Loading the XML data into Flash |
|
|
508 | (3) |
|
Creating the Futuremedia site's data structure |
|
|
511 | (1) |
|
How the page array is structured |
|
|
511 | (2) |
|
Populating the actual data values |
|
|
513 | (4) |
|
|
|
517 | (4) |
|
|
|
521 | (1) |
|
|
|
522 | (3) |
|
Finishing the Futuremedia Case Study |
|
|
525 | (34) |
|
Getting the data into the user interface |
|
|
526 | (7) |
|
Amending the way events are handled |
|
|
530 | (1) |
|
|
|
531 | (2) |
|
|
|
533 | (7) |
|
Making sure the Ul knows where it needs to return |
|
|
533 | (3) |
|
How the buildlcon() function works |
|
|
536 | (4) |
|
Tidying up the user interface |
|
|
540 | (17) |
|
|
|
544 | (4) |
|
Adding the status text messages |
|
|
548 | (3) |
|
|
|
551 | (4) |
|
Loading your own content into the site |
|
|
555 | (1) |
|
|
|
556 | (1) |
|
|
|
557 | (2) |
|
Advanced ActionScript: Components and Classes |
|
|
559 | (48) |
|
Flash version 2 components |
|
|
560 | (27) |
|
Getting more out of components with ActionScript |
|
|
563 | (2) |
|
Components and event handling |
|
|
565 | (1) |
|
|
|
565 | (4) |
|
|
|
569 | (1) |
|
Understanding the advantages of event listeners |
|
|
570 | (2) |
|
|
|
572 | (1) |
|
|
|
572 | (3) |
|
|
|
575 | (1) |
|
Combo boxes (drop-down menus) |
|
|
576 | (7) |
|
Using code hints with components |
|
|
583 | (1) |
|
Loading components at runtime |
|
|
584 | (2) |
|
|
|
586 | (1) |
|
|
|
587 | (1) |
|
|
|
587 | (17) |
|
The future road map for ActionScript |
|
|
588 | (1) |
|
|
|
589 | (2) |
|
How class-based coding works |
|
|
591 | (6) |
|
|
|
597 | (3) |
|
Extending a built-in class |
|
|
600 | (2) |
|
Storing classes in a central location |
|
|
602 | (2) |
|
|
|
604 | (3) |
| Index |
|
607 | |