328
Chapter 10
CHAPTER TEN
ActionScript
Hacks 74–85
ActionScript adds true power to Flash. Without ActionScript, Flash can cre-
ate 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 Action-
Script, 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 flexi-
ble 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 interactiv-
ity, 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 “Increase Code Performance” section in
Chapter 9 addresses ActionScript optimization. This book also covers per-
formance 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 regard-
ing converting ActionScript 2.0 (used widely in this book) to ActionScript 1.0.

Get Flash Hacks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.