Letter from the Series Editor |
|
xxiii | |
Introduction |
|
xxv | |
|
|
1 | (78) |
|
|
3 | (24) |
|
|
4 | (2) |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
7 | (2) |
|
|
9 | (2) |
|
Importing Graphics and Sound |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
13 | (2) |
|
|
15 | (2) |
|
|
17 | (3) |
|
|
17 | (1) |
|
|
17 | (1) |
|
|
18 | (1) |
|
|
18 | (2) |
|
|
20 | (2) |
|
|
22 | (1) |
|
|
22 | (1) |
|
|
23 | (1) |
|
|
23 | (1) |
|
|
23 | (2) |
|
|
25 | (2) |
|
|
27 | (52) |
|
|
28 | (1) |
|
Where Does the Script Go? |
|
|
29 | (6) |
|
|
30 | (2) |
|
Frame Scripts in Movie Clips |
|
|
32 | (1) |
|
Instance Scripts and Event Handlers |
|
|
33 | (2) |
|
|
35 | (3) |
|
|
35 | (1) |
|
|
36 | (2) |
|
|
38 | (1) |
|
|
39 | (2) |
|
|
41 | (2) |
|
|
43 | (4) |
|
Pre-Increment and Post-Increment (++) |
|
|
44 | (1) |
|
Pre-Decrement and Post-Decrement (--) |
|
|
44 | (1) |
|
|
45 | (1) |
|
Compound Assignments (+=, -=, *=, /=, %=) |
|
|
46 | (1) |
|
|
47 | (1) |
|
|
47 | (1) |
|
|
48 | (1) |
|
|
49 | (1) |
|
|
49 | (1) |
|
|
49 | (3) |
|
|
50 | (1) |
|
|
51 | (1) |
|
|
51 | (1) |
|
|
52 | (1) |
|
|
52 | (3) |
|
|
52 | (1) |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
54 | (1) |
|
|
55 | (1) |
|
|
55 | (10) |
|
|
55 | (1) |
|
|
56 | (1) |
|
|
57 | (2) |
|
|
59 | (1) |
|
|
60 | (5) |
|
|
65 | (1) |
|
|
66 | (4) |
|
|
66 | (1) |
|
|
67 | (1) |
|
|
68 | (2) |
|
|
70 | (3) |
|
|
70 | (1) |
|
|
70 | (1) |
|
|
71 | (1) |
|
|
72 | (1) |
|
|
72 | (1) |
|
|
73 | (1) |
|
|
73 | (5) |
|
|
73 | (1) |
|
|
74 | (1) |
|
Logical Operator Precedence |
|
|
75 | (1) |
|
Using NOT (!) and the Logical Operators |
|
|
76 | (1) |
|
|
77 | (1) |
|
|
78 | (1) |
|
|
79 | (290) |
|
Programming Interactivity: Mouse Chaser |
|
|
81 | (48) |
|
|
82 | (10) |
|
|
82 | (6) |
|
|
88 | (4) |
|
|
92 | (4) |
|
|
92 | (2) |
|
|
94 | (2) |
|
|
96 | (1) |
|
|
96 | (5) |
|
|
97 | (1) |
|
|
97 | (3) |
|
The _xscale and _yscale Properties |
|
|
100 | (1) |
|
The _width and _height Properties |
|
|
100 | (1) |
|
|
100 | (1) |
|
|
101 | (1) |
|
|
101 | (6) |
|
|
102 | (1) |
|
|
103 | (1) |
|
|
104 | (2) |
|
|
106 | (1) |
|
The _xmouse and _ymouse Properties |
|
|
107 | (1) |
|
|
108 | (20) |
|
|
109 | (1) |
|
Creating the Library Assets |
|
|
110 | (5) |
|
|
115 | (1) |
|
|
116 | (10) |
|
|
126 | (1) |
|
|
127 | (1) |
|
|
128 | (1) |
|
Creating Instances Dynamically: The Button Menu |
|
|
129 | (54) |
|
Dynamic Movie Clip Instances |
|
|
130 | (11) |
|
Exporting a Library Symbol |
|
|
130 | (2) |
|
Creating a Dynamic Clip Instance |
|
|
132 | (2) |
|
|
134 | (2) |
|
|
136 | (1) |
|
Duplicating Dynamic Clips |
|
|
136 | (2) |
|
|
138 | (2) |
|
|
140 | (1) |
|
|
141 | (1) |
|
Attaching Event Handlers to Dynamic Clips |
|
|
141 | (8) |
|
Scoping Rules for Dynamic Event Handlers |
|
|
143 | (1) |
|
|
144 | (1) |
|
|
145 | (1) |
|
|
145 | (1) |
|
|
146 | (1) |
|
|
146 | (3) |
|
|
149 | (9) |
|
|
150 | (3) |
|
|
153 | (3) |
|
|
156 | (2) |
|
Controlling Movie Playback |
|
|
158 | (6) |
|
|
158 | (2) |
|
|
160 | (1) |
|
|
160 | (1) |
|
|
161 | (1) |
|
|
161 | (1) |
|
|
162 | (1) |
|
The _currentframe Property |
|
|
162 | (1) |
|
The _totalframes Property |
|
|
163 | (1) |
|
|
164 | (17) |
|
|
165 | (2) |
|
The Button Implementation |
|
|
167 | (12) |
|
|
179 | (2) |
|
|
181 | (1) |
|
|
181 | (2) |
|
Arrays: Match 'Em Up and Sliders |
|
|
183 | (68) |
|
|
184 | (1) |
|
|
185 | (1) |
|
|
185 | (1) |
|
|
186 | (18) |
|
|
186 | (1) |
|
|
187 | (17) |
|
|
204 | (1) |
|
|
204 | (1) |
|
|
205 | (3) |
|
Accessing Movie Clip Properties as an Array |
|
|
208 | (2) |
|
|
210 | (19) |
|
|
210 | (1) |
|
Creating the Library Assets |
|
|
210 | (1) |
|
|
210 | (1) |
|
|
211 | (11) |
|
|
222 | (4) |
|
|
226 | (3) |
|
|
229 | (20) |
|
|
229 | (1) |
|
Creating the Library Assets |
|
|
230 | (3) |
|
|
233 | (12) |
|
|
245 | (4) |
|
|
249 | (2) |
|
|
251 | (118) |
|
What Is an Object? The Basics |
|
|
252 | (3) |
|
|
253 | (1) |
|
Global Objects Versus Instance Objects |
|
|
253 | (1) |
|
|
253 | (1) |
|
|
254 | (1) |
|
|
254 | (1) |
|
|
255 | (1) |
|
|
255 | (78) |
|
|
256 | (25) |
|
|
281 | (51) |
|
Client/Server and Authoring Objects |
|
|
332 | (1) |
|
|
333 | (34) |
|
|
333 | (1) |
|
|
334 | (24) |
|
|
358 | (1) |
|
|
359 | (8) |
|
|
367 | (2) |
|
Part Three Intermediate Games |
|
|
369 | (162) |
|
Real-Time Programming: Shoot 'Em Up |
|
|
371 | (56) |
|
|
372 | (3) |
|
|
373 | (1) |
|
The clearlnterval Function |
|
|
374 | (1) |
|
|
375 | (3) |
|
What Is a Finite State Machine? |
|
|
375 | (1) |
|
|
375 | (3) |
|
|
378 | (47) |
|
|
379 | (2) |
|
|
381 | (10) |
|
|
391 | (4) |
|
|
395 | (19) |
|
|
414 | (3) |
|
|
417 | (1) |
|
|
418 | (7) |
|
|
425 | (2) |
|
Advanced Timing and Trigonometry: Blow 'Em Up |
|
|
427 | (76) |
|
|
428 | (2) |
|
|
430 | (1) |
|
|
430 | (10) |
|
|
431 | (1) |
|
|
432 | (1) |
|
|
432 | (2) |
|
Implementing the Distance Formula in Flash |
|
|
434 | (1) |
|
Relative Distance and the Improved Distance Formula |
|
|
435 | (2) |
|
The Problem of Movement Revisited |
|
|
437 | (3) |
|
|
440 | (10) |
|
|
440 | (2) |
|
The Trigonometric Functions |
|
|
442 | (4) |
|
|
446 | (2) |
|
Implementing Rotation in Flash |
|
|
448 | (1) |
|
Trigonometry on Any Triangles |
|
|
449 | (1) |
|
|
450 | (52) |
|
|
450 | (2) |
|
|
452 | (4) |
|
|
456 | (6) |
|
|
462 | (30) |
|
|
492 | (1) |
|
|
492 | (10) |
|
|
502 | (1) |
|
Object-Oriented Programming with AS 2.0 |
|
|
503 | (28) |
|
|
504 | (2) |
|
|
505 | (1) |
|
|
506 | (13) |
|
|
506 | (1) |
|
|
507 | (4) |
|
|
511 | (2) |
|
|
513 | (1) |
|
|
513 | (5) |
|
|
518 | (1) |
|
|
519 | (11) |
|
|
519 | (8) |
|
Compile-Time and Run-Time Features |
|
|
527 | (2) |
|
|
529 | (1) |
|
|
530 | (1) |
|
Part Four Advanced Games and Topics |
|
|
531 | (160) |
|
Artificial Intelligence: Tic Tac Toe |
|
|
533 | (48) |
|
|
534 | (1) |
|
|
535 | (6) |
|
Recursion Example: Factorial |
|
|
535 | (2) |
|
|
537 | (2) |
|
|
539 | (1) |
|
|
540 | (1) |
|
|
541 | (1) |
|
|
542 | (2) |
|
|
544 | (1) |
|
|
545 | (34) |
|
|
545 | (1) |
|
|
545 | (1) |
|
|
546 | (2) |
|
|
548 | (24) |
|
|
572 | (1) |
|
|
573 | (6) |
|
|
579 | (2) |
|
|
581 | (76) |
|
|
582 | (8) |
|
Addition and Subtraction with Vectors |
|
|
584 | (1) |
|
Scalar Multiplication with Vectors |
|
|
585 | (1) |
|
|
586 | (1) |
|
|
587 | (1) |
|
Vector Multiplication: The Dot Product |
|
|
588 | (2) |
|
|
590 | (23) |
|
|
590 | (1) |
|
|
591 | (1) |
|
|
591 | (1) |
|
|
591 | (1) |
|
|
592 | (1) |
|
|
592 | (2) |
|
|
594 | (1) |
|
|
595 | (1) |
|
|
596 | (6) |
|
|
602 | (11) |
|
|
613 | (1) |
|
|
614 | (2) |
|
|
616 | (40) |
|
|
617 | (8) |
|
|
625 | (24) |
|
|
649 | (1) |
|
|
650 | (6) |
|
|
656 | (1) |
|
Server-Side Support for Flash: Highscore Boards |
|
|
657 | (34) |
|
Communicating with the Server |
|
|
658 | (5) |
|
Loading .swf Files from the Server |
|
|
659 | (3) |
|
|
662 | (1) |
|
|
663 | (1) |
|
|
664 | (10) |
|
Loading Text Files from the Server |
|
|
668 | (4) |
|
Triggering Actions at the End of a Load: onData |
|
|
672 | (1) |
|
Cross-Domain Security Model |
|
|
673 | (1) |
|
Communicating with the Browser |
|
|
674 | (2) |
|
Calling a JavaScript Routine from Flash |
|
|
676 | (2) |
|
|
678 | (3) |
|
|
679 | (1) |
|
|
679 | (1) |
|
|
680 | (1) |
|
|
680 | (1) |
|
Creating a Highscore Board |
|
|
681 | (9) |
|
Setting Up Flash for Highscore Boards |
|
|
681 | (4) |
|
|
685 | (4) |
|
Final Tips on Highscore Boards |
|
|
689 | (1) |
|
|
690 | (1) |
|
|
690 | (1) |
|
|
691 | (4) |
|
Appendix A ASCII Character Chart |
|
|
695 | (8) |
|
Appendix B Key Object Bindings |
|
|
703 | (6) |
|
|
709 | (10) |
|
|
710 | (1) |
|
|
710 | (9) |
|
|
711 | (1) |
|
|
712 | (3) |
|
|
715 | (4) |
|
Appendix D Web Resources and Further Reading |
|
|
719 | (4) |
|
|
720 | (1) |
|
General Game Development Links |
|
|
721 | (1) |
|
|
721 | (1) |
|
|
721 | (2) |
Index |
|
723 | |