Synopses & Reviews
In September 2003, Macromedia released Flash MX 2004, and with it, ActionScript 2.0, a dramatically improved version of Flash's programming language. ActionScript 2.0 introduces a formal object-oriented programming syntax and methodology for creating Flash applications. From a developer's perspective, the new OOP-based techniques in ActionScript 2.0 make applications more natural to plan and conceptualize, more stable, more reusable across projects, easier to maintain, change, and expand upon, and much more. In short, they enhance the entire development process.In Essential ActionScript 2.0, bestselling author Colin Moock--one of the most universally respected developers in the Flash community--covers everything you'll need to know about the new ActionScript language and its methodologies for producing movies, animation, and applications on the web. Moock guides readers through this important new territory with his trademark easy-to-understand style and expertise. Moock's goal throughout the book is not just to get you to use object-oriented programming in your daily Flash work: he wants you to reap the benefits of OOP; he wants you to understand ActionScript 2.0 completely. And without question, Moock is the author who can make this happen.Essential ActionScript 2.0 begins with a tour of the language, including the fundamentals of object-oriented concepts, syntax, and usage. Those who are new to OOP will learn the basics and how to apply their understanding. Those who are familiar with OOP will leverage their prior experience to learn about Flash-based OOP. The next part of the book shows how to structure entire applications with ActionScript 2.0, teaching you best practices and techniques to build scalable, extensible, stable apps. Next, you'll explore a variety of approaches to various programming situations by applying object-oriented programming strategies, known as design patterns, to Flash.Experienced Flash developers and programmers coming from other languages will enjoy the sheer depth of Moocks's coverage and expertise in Essential ActionScript 2.0. Novice programmers will appreciate the frequent, low-jargon explanations that are often glossed over by advanced programming books. As usual, Moock guarantees quality and accuracy by working closely with Macromedia Flash engineers, including Rebecca Sun, lead developer of ActionScript 2.0.Whether you're ready to make the move to ActionScript 2.0 now or simply assessing it for the future, you'll find everything you need to know within this book. Essential ActionScript 2.0 is the one book every ActionScript coder must own.
In "Essential ActionScript 2.0, bestselling author Colin Moock covers everything you'll need to know about the new ActionScript language and its methodologies. Moock guides readers through this important new territory with his trademark easy-to-understand style and expertise. The book begins with a tour of the language, including the fundamentals of object-oriented concepts, syntax, and usage. The next part of the book shows how to structure entire applications with ActionScript 2.0, teaching you best practices and techniques to build scalable, extensible, stable apps. Finally, you'll explore a variety of approaches to various programming situations by applying object-oriented programming strategies, known as design patterns, to Flash. Experienced Flash developers and programmers coming from other languages will enjoy the sheer depth of Moocks's coverage and expertise in "Essential ActionScript 2.0. Novice programmers will appreciate the frequent, low-jargon explanations that are often glossed over by advanced programming books.
About the Author
Colin Moock is an independent web guru with a passion for networked creativity and expression. He is author of the world-renowned guide to Flash programming, ActionScript for Flash MX: The Definitive Guide (O Reilly & Associates, 2003). A web professional since 1995, Moock runs one of the Web s most venerable Flash developer sites, http://www.moock.org. He spends most of his time pursuing his cardinal interest, multiuser application development, and working on Unity (http://www.moock.org/unity), moock.org s complete commercial framework for creating and deploying multiuser applications for Macromedia Flash.
Table of Contents
Foreword; Preface; This Book Wants You; What This Book Is Not; Who Should (and Shouldn't) Read This Book; ActionScript 2.0 Versus ActionScript 1.0; Deciphering Flash Versions; Example Files and Resources; Typographical Conventions; Using Code Examples; We'd Like to Hear from You; Acknowledgments; Part I: The ActionScript 2.0 Language; Chapter 1: ActionScript 2.0 Overview; 1.1 ActionScript 2.0 Features; 1.2 Features Introduced by Flash Player 7; 1.3 Flash MX 2004 Version 2 Components; 1.4 ActionScript 1.0 and 2.0 in Flash Player 6 and 7; 1.5 Let's Go OOP; Chapter 2: Object-Oriented ActionScript; 2.1 Procedural Programming and Object-Oriented Programming; 2.2 Key Object-Oriented Programming Concepts; 2.3 But How Do I Apply OOP?; 2.4 On with the Show!; Chapter 3: Datatypes and Type Checking; 3.1 Why Static Typing?; 3.2 Type Syntax; 3.3 Compatible Types; 3.4 Built-in Dynamic Classes; 3.5 Circumventing Type Checking; 3.6 Casting; 3.7 Datatype Information for Built-in Classes; 3.8 ActionScript 2.0 Type Checking Gotchas; 3.9 Up Next: Creating Classes--Your Own Datatypes!; Chapter 4: Classes; 4.1 Defining Classes; 4.2 Constructor Functions (Take 1); 4.3 Properties; 4.4 Methods; 4.5 Constructor Functions (Take 2); 4.6 Completing the Box Class; 4.7 Putting Theory into Practice; Chapter 5: Authoring an ActionScript 2.0 Class; 5.1 Class Authoring Quick Start; 5.2 Designing the ImageViewer Class; 5.3 ImageViewer Implementation (Take 1); 5.4 Using ImageViewer in a Movie; 5.5 ImageViewer Implementation (Take 2); 5.6 ImageViewer Implementation (Take 3); 5.7 Back to the Classroom; Chapter 6: Inheritance; 6.1 A Primer on Inheritance; 6.2 Subclasses as Subtypes; 6.3 An OOP Chat Example; 6.4 Overriding Methods and Properties; 6.5 Constructor Functions in Subclasses; 6.6 Subclassing Built-in Classes; 6.7 Augmenting Built-in Classes and Objects; 6.8 The Theory of Inheritance; 6.9 Abstract and Final Classes Not Supported; 6.10 Let's Try Inheritance; Chapter 7: Authoring an ActionScript 2.0 Subclass; 7.1 Extending ImageViewer's Capabilities; 7.2 The ImageViewerDeluxe Skeleton; 7.3 Adding setPosition( ) and setSize( ) Methods; 7.4 Autosizing the Image Viewer; 7.5 Using ImageViewerDeluxe; 7.6 Moving Right Along; Chapter 8: Interfaces; 8.1 The Case for Interfaces; 8.2 Interfaces and Multidatatype Classes; 8.3 Interface Syntax and Use; 8.4 Multiple Type Inheritance with Interfaces; 8.5 Up Next, Packages; Chapter 9: Packages; 9.1 Package Syntax; 9.2 Defining Packages; 9.3 Package Access and the Classpath; 9.4 Simulating Packages in ActionScript 1.0; 9.5 Just a Little More Theory; Chapter 10: Exceptions; 10.1 The Exception-Handling Cycle; 10.2 Handling Multiple Types of Exceptions; 10.3 Exception Bubbling; 10.4 The finally Block; 10.5 Nested Exceptions; 10.6 Control Flow Changes in try/catch/finally; 10.7 Limitations of Exception Handling in ActionScript 2.0; 10.8 From Concepts to Code; Part II: Application Development; Chapter 11: An OOP Application Framework; 11.1 The Basic Directory Structure; 11.2 The Flash Document (.fla file); 11.3 The Classes; 11.4 The Document Timeline; 11.5 The Exported Flash Movie (.swf file); 11.6 Projects in Flash MX Professional 2004; 11.7 Let's See It in Action!; Chapter 12: Using Components with ActionScript 2.0; 12.1 Currency Converter Application Overview; 12.2 Preparing the Flash Document; 12.3 The CurrencyConverter Class; 12.4 Handling Component Events; 12.5 Components Complete; Chapter 13: MovieClip Subclasses; 13.1 The Duality of MovieClip Subclasses; 13.2 Avatar: A MovieClip Subclass Example; 13.3 Avatar: The Composition Version; 13.4 Issues with Nested Assets; 13.5 A Note on MovieClip Sub-subclasses; 13.6 Curiouser and Curiouser; Chapter 14: Distributing Class Libraries; 14.1 Sharing Class Source Files; 14.2 Sharing Classes Without Sharing Source Files; 14.3 Solving Real OOP Problems; Part III: Design Pattern Examples in ActionScript 2.0; Chapter 15: Introduction to Design Patterns; 15.1 Bring on the Patterns; Chapter 16: The Observer Design Pattern; 16.1 Implementing Observer in ActionScript 2.0; 16.2 Logger: A Complete Observer Example; 16.3 Memory Management Issues with Observer; 16.4 Beyond Observer; Chapter 17: The Singleton Design Pattern; 17.1 Implementing Singleton in ActionScript 2.0; 17.2 The Singleton Pattern in the Logger Class; 17.3 Singleton Versus Class Methods and Class Properties; 17.4 A Warning Against Singletons as Globals; 17.5 On to User Interfaces; Chapter 18: The Model-View-Controller Design Pattern; 18.1 The General Architecture of MVC; 18.2 A Generalized MVC Implementation; 18.3 An MVC Clock; 18.4 Further Exploration; Chapter 19: The Delegation Event Model; 19.1 Structure and Participants; 19.2 The Flow of Logic; 19.3 Core Implementation; 19.4 NightSky: A Delegation Event Model Example; 19.5 Other Event Architectures in ActionScript; 19.6 From Some Place to Some OtherPlace; Part IV: Appendixes; Appendix A: ActionScript 2.0 Language Quick Reference; A.1 Global Properties; A.2 Global Functions; Appendix B: Differences from ECMAScript Edition 4; Colophon;