Hacks #74-85

ActionScript adds true power to Flash. Without ActionScript, Flash can create only linear animation. With a little ActionScript, you can create basic navigation via clickable buttons and hotspots. Learning more advanced ActionScript techniques gives you access to features such as creating a local shared object (colloquially known as a "Flash cookie"). Without ActionScript, you cannot create Flash sites that communicate with the browser, exchange data with server-side applications, or download MP3 files.

Many new features in Flash MX 2004 and Flash MX Professional 2004 are implemented on the assumption that the developer knows ActionScript. Even features that assume no coding experience, such as Behaviors and Timeline Effects, can be implemented in a much more structured and flexible way if the developer has some knowledge of ActionScript.

Although timeline animation is easy to learn, what takes days or months to create by hand can often be coded in ActionScript in minutes or hours. And when designers want to implement applications with advanced interactivity, decision-making logic, or communication features, they need to learn ActionScript. Whether you are building Rich Internet Applications (RIAs), online games, or advanced GUIs, they all rely on scripting.

Although this chapter focuses on ActionScript, scripting appears in almost every hack in this book. The Section 9.4 section in Chapter 9 addresses ActionScript optimization. This book also covers performance related-hacks, such as bytecode optimization [Hack #100] . So you can learn a lot of ActionScript by trying the hacks as presented and modifying them to create your own hacks. See also the discussion in the Preface regarding converting ActionScript 2.0 (used widely in this book) to ActionScript 1.0.

For a thorough introduction to ActionScript, see ActionScript for Flash MX: The Definitive Guide. For an extensive study on using ActionScript 2.0 for object-oriented programming, see Essential ActionScript 2.0. Both were written by Colin Moock and are published by O'Reilly.