Paul Robertson's words, punctuated

Thoughts on development, user-centered design, code, etc. by Paul Robertson

Book Review: ActionScript 3.0 Cookbook

With the release of Flex 2 and ActionScript 3.0, I started to watch for new books coming out. Admittedly the numbers have been smaller than I expected, but the first book to hit the shelves – one I’ve been anticipating with enthusiasm – is the ActionScript 3.0 Cookbook by Joey Lott, Darron Schall, and Keith Peters.

Book summary

This book obviously covers ActionScript 3.0, the (as of this writing) most current version of ActionScript. ActionScript 3.0 is used in Adobe Flex, including Adobe’s Flex Builder tool; it is also the language used in the not-yet-but-soon-to-be-released Adobe Flash CS3 (a.k.a. “Blaze” or version 9). However, since the book was written primarily while Flex was in beta, and Flash was not even released as a public alpha, all the recipes that involve the IDE refer specifically to Flex Builder. The book is written and organized in the O’Reilly “cookbook” format, where each chapter includes several “recipes” written as a problem, a solution to the problem, and a discussion/explanation of the solution. I think of books like this as “task-based reference” books – they’re meant to be used like a reference, that you can look up something you want when you need it – but they show how to accomplish a particular task rather than showing how to use a particular language element. That way, if you know you want to do something in particular (e.g. “simulate rolling dice in ActionScript”) but don’t know which methods or properties you would use to accomplish the task, you can just look it up in the book and it will tell you.

What I liked best

There are several aspects of this book that offer a lot of value. The ones which stood out most to me are:

Coverage of specific use cases and more advanced functionality

Some parts of ActionScript 3.0 have very obvious uses–the DropShadowFilter class, for example, has a pretty obvious use. However, there are several aspects of the language (such as the Bitmap class, the ByteArray class, the DisplacementMap filter, the ConvolutionFilter, etc.) that provide very “open-ended” functionality. There are lots of different things you can do with them, but you have to know what they are and understand some particular programming topic (like graphics manipulation or working with byte data) in order to make use of them. This book describes how to perform some of the tasks that can be performed using these “open-ended” classes. This, in my opinion, is the perfect use of the cookbook format.

In the topics where it shines, this book really shines. I was very impressed with the sophistication of many of the topics that are covered (for example, topic 4.10 “Cards”).

Supplemental code library

The book has a significant library of supplemental code (available as a free download). Several of the recipes use the code in this library to accomplish their tasks. For example, the solution to the recipe “Simulating Dice” is to “use the NumberUtilities.random() method [from the supplemental code library] to generate random numbers in the desired range.” In truth I can see plusses and minuses to this approach. It definitely saves time for the reader – if you’re on a deadline and trying to build that Dungeons & Dragons simulator then having the code already written is a big benefit. It also saves pages in the book, and avoids the need for in-depth explanations (and nearly-redundant explanations, such as those for “Simulating a coin toss” and “Simulating dice”) since all the book needs is a few lines demonstrating how to call the method in the supplemental code. However, if you’re the reader who wants to learn more, or to understand the principles behind the solution as well as the code needed to carry out those principles, you’re left feeling pretty empty. I think one possible compromise (which isn’t done) might be to have a more in-depth explanation for such sections, perhaps showing a few relevent lines of code extracted from the code library, demonstrating how the code library works and how you might adapt it or build your own similar solution.

Breadth of topic coverage

The ActionScript 3.0 documentation that comes with Flex 2 includes two main parts: the reference documentation, and a book called ”Programming ActionScript 3.0.” However, due to various factors there are several topics that aren’t covered in “Programming ActionScript 3.0” in the Flex 2 release. These include topics such as working with TextField objects, filters, and bitmap manipulation, among others. The “ActionScript 3.0 Cookbook” can help to fill in these gaps because it does provide coverage of some of those “missing” topics. Admittedly, one of the reasons those topics aren’t covered in the Flex 2 documentation is because they are largely irrelevent for a Flex-only application–for example, in Flex you use the TextArea component or TextInput component to display text, rather than just a TextField component. In any case, they do get some coverage in the “ActionScript 3.0 Cookbook.” As a side note, several new chapters are being added to “Programming ActionScript 3.0,” to be released with the next version of Flash, covering many of these parts of ActionScript that aren’t commonly used in Flex, such as text fields, movie clips, more on display programming, video, sound, filters, and so on.

Room for improvement

As you may have gathered from the previous section, one way I judge a computer book is how well it supplements the manufacturer-provided documentation rather than just rehashing the same material (see disclaimer). I also think it’s important for a book to be consistent to its purpose. If it’s supposed to be a reference, it should just be a reference. If it’s supposed to be an instructional book written as a series of lessons, it should stick to that format. With a topic like ActionScript there’s no way a single book can be all these things, so I think it’s important for the book to stick to what it does best, and let other books fill in other roles.

As the preceding paragraph implies, I have some disagreements with this book in terms of its overlap with the ActionScript 3.0 documentation and its consistency with its stated goal of being a “cookbook.”

Too much redundancy with the official documentation

The question I kept asking myself as I was reading through this book is “what is a cookbook, really?” In my mind, a “cookbook” is a book whose topics are more “edgy” or involved than what you might find in the core documentation. It should cover how to accomplish specific tasks that aren’t easily figured out and aren’t found elsewhere (again, especially not in the main documentation). It should also include “hacks” or workarounds to accomplishing things that aren’t readily available using the built-in functionality of the language. After all, I can learn (for example) the syntax for writing a class or the syntax for adding a display object to the screen by reading the built-in documentation, so why would I need to buy a cookbook to tell me how? On the other hand, the built-in documentation doesn’t (and likely will never) tell me how to do more specific implementation tasks, like “simulating rolling dice” or “creating a graphical texture,” but they’re common enough programming problems that those are topics I’d expect to find in a cookbook.

Admittedly, when I first started working with ActionScript 3.0, one of the first thoughts that came to me was “I wonder what they’re going to put in the ActionScript Cookbook.” ActionScript 3.0 by itself is a big improvement over the previous version, and many of the things that used to require workarounds are really straightforward now – so I wondered what they’d do to replace all of those topics in the book. Unfortunately it looks like they didn’t do anything to replace them.

As I mentioned in the “good” section, there are lots of topics covered in this book that fit squarely in what I consider to be an appropriate cookbook topic. But there are also plenty of topics that I think should have been left in the built-in documentation rather than needing to repeat them in the ActionScript 3.0 Cookbook. Some key examples are topics related to basic syntax. For example, “Creating a Custom Class” and its related topics “Creating Properties that Behave as Methods,” “Creating Static Methods,” “Creating Subclasses,” etc. All of these topics are covered in the built-in documentation, both in a basic form and in greater depth than this book can afford. In addition, these aren’t topics that a person is going to need to look up frequently. Chances are, a person who’s new to ActionScript or who’s been using it for a while and wants to “move up” to using custom classes will need that information. However, once a person has created a handfull of custom classes, they’re not going to need to look up the syntax in the book any more–they’ll already know it or else they’ll just look at a class they created, etc. So there’s little benefit to that content being provided in this book.

Too much discussion on some topics

This is related to the previous criticism. For example, I said that I thought it was redundant for the ActionScript 3.0 Cookbook to have a recipe for “Creating a Custom Class” since that topic is covered in detail in the in-product documentation. However, suppose the publisher wants to fill up the topic list. Or suppose a person who’s “moving up” to creating custom classes has read the chapter on creating a custom class in Programming ActionScript 3.0, and has a decent understanding of the concepts, but just can’t remember the syntax. I admit that there could be some value in having a quick reference place to turn to to find the syntax for creating a custom class. However, at that point the person doesn’t want to read through four pages of explanation about creating a custom class – they just want to see the recipe solution and copy it into their own code. Unfortunately, this book could do that, but it doesn’t. Rather than just give a nice model of a custom class, it spends four pages talking about it. The section on display programming is even more bulky – while they might justifiably have had several one-page-or-less-each recipes on things like “adding a display object to the display list,” “removing an object from the display list,” “reordering objects on the display list,” etc., the book spends 14 pages talking about what the display list is and how it works. That’s nice, but it’s not the point of this book in my opinion. The built-in documentation has even more thorough, detailed explanations about what the display list is, what types of objects can be used, etc. If the cookbook wants to do its readers a service, it should trim that fat, which would make it easier to find the specific method name or syntax – a quick resource to turn to for those “I know I’ve seen this before but I can’t quite remember how to do it” sorts of questions.


In summary, I have mixed feelings about this book. When it’s good, it really shines–the sections that go into more depth or into a more advanced topic than Adobe’s ActionScript 3.0 documentation are really valuable. However, a significant part of the book is redundant with the documentation, doesn’t cover it in as much detail as the built-in documentation, but covers it in so much detail that the benefits of the “cookbook” format are lost.

Book details

  • Title: ActionScript 3.0 Cookbook (On (Publisher’s page)
  • Authors: Joey Lott, Darron Schall, and Keith Peters
  • Publisher: O’Reilly
  • Copyright year: 2007
  • ISBN 10: 0-596-52695-4
  • ISBN 13: 978-0-596-52695-5


  1. As a contract employee, I helped write the Flex 2 ActionScript documentation, including one chapter and parts of other chapters in “Programming ActionScript 3.0” as well as a handful of samples for the ActionScript language reference. I now work as a full-time employee for Adobe, and one of my current roles is as lead writer of “Programming ActionScript 3.0” for the Flash version 9 release–so I obviously I am not unbiased about the Adobe-provided ActionScript documentation.
  2. I received this book at a heavily discounted price in exchange for writing this review. While it’s impossible to remove myself from that detail completely, I have tried my best to make this an unbiased review. Want to know how to get discounted books in exchange for making reviews? Contact your local Adobe Users’ Group.