Joey Lott, Darron Schall, and Keith Peters provide one of the first published overviews of Flash 9 and AS3 in the ActionScript 3 Cookbook. I had never picked up one of O’Reilly’s “cookbooks” before, but I quickly discovered that this format might be perfect for my picky reading habits. The book comes in at over 500 pages, and it’s the first release from the new O’Reilly/Adobe partnership known as the Adobe Developer Library.
Like most programming language books, each chapter in the AS3 Cookbook focuses on a specific aspect of the language. One chapter focuses on the Display List, another on Arrays, and so on into Bitmaps, Math, and others. What sets this style of book apart is that each chapter contains a series of short “recipes” that focus on the chapter’s main subject. For instance, the Regular Expression chapter includes solutions for simple problems like replacing text and validating user input, but an additional discussion section provides a few extra insights that more comprehensive language books might miss.
I found myself immersed in chapters on core language features, like the one on Arrays, even though I felt I knew these subjects pretty darn well already. With so many short and sweet sections, I discovered a dozen different tricks that I know I can use in my everyday development. For example, did you know that you can easily copy a single-dimensional Array by calling the concat()
method with no arguments?
var myCopy:Array = myArray.concat()
Somehow, that had slipped under my radar.
I didn’t have too many issues with this book. Mostly, I found myself wanting to count the number of typos I discovered. You can expect to see a second printing, if only to fix the spelling mistakes and missing letters here and there. They’re not overly distracting, though. I had too much fun with the subject matter to let it bother me. I also noticed that there are several references to Flash Player 8.5. In some cases, it seemed to work, but in others I wondered if it would just be better to say Flash Player 9. Since it was released as an alpha player, it probably shouldn’t be considered an official release. SWFs made with the alpha version of the Flex 2 compiler won’t run in the official Flash 9 player these days. I’m guessing we won’t see it in the archives either.
All in all, the ActionScript 3.0 Cookbook kept me pretty entertained. I enjoyed that its recipes fit into a page or two each because I could easily sit down and read a couple when I had a few extra minutes. The next time I picked it up, I’d be jumping into fresh material that generally didn’t depend on previous sections. If you’re looking for a definitive language overview, this book isn’t what you want. You’ll probably want to pick up Essential ActionScript 3.0 when it comes out next year. Keep the AS3 Cookbook close to your desk as a quick reference for useful tricks or to give you a crash-course on a particular feature that you haven’t used yet.
Is that array.concat trick AS3-only?
Nope, the LiveDocs say that it works in AS2 as well.
Josh,
Would you recommend someone, who’s new to ActionScript, read the cookbook to learn AS fundamentals, or focus more on a book like Essential ActionScript “2.0”?
My concern with reading an AS 2.0 book is that I’d be learning things specific to AS2, when they may no longer be relevant to AS3.
Care to offer some advice?
Frank,
I personally recommend learning Actionscript with Object-Oriented Actionscript for Flash 8. While the book specifically uses AS2, it’s focus on OOP and best practices should make your transition to AS3 pretty easy.
If you’re still wary of difficulties, you might consider picking up a good AS2 book and the AS3 Cookbook at the same time. As you learn something new in AS2, you can make reference to the cookbook to see how the same thing is done in AS3. You won’t always find the same material, but the AS3 Cookbook still covers many of the basics.
Josh,
Thanks for getting back to me. I browsed through the OO for AS2 book at the book store, but found it required Flash (dev tool) in order to fully take advantage of the book. Or am i mistaken?
I have Essential AS2 and have been reading the chapters that don’t depend on Flash… I ordered the cookbook and was contemplating whether I should jump straight to the cookbook or learn the fundamentals through AS2…
What do you think?
I guess it mostly depends on how well you think you will do. If you’re experienced with other programming languages, like Java or C#, then I’d say jump right into the Actionscript 3.0 Cookbook. If not, it might be smarter to get the fundamentals from an AS2 book. I haven’t read Essential AS2 in a couple of years, so I can’t say if it’s a good starting point anymore. I seem to remember skipping most of it and learning on my own. A lot of folks recommend it, though.
Josh,
Yeah, I figured the same when I started reading it… My background is in Java, but lately (as in the last 18months) has been mainly Javascript.
I may continue with the Essential AS2 book and simply skip the chapters that focus more on Flash and less on ActionScript, and then move on from there.
One thing I’ve always wondered about the OO book you mentioned above, was whether or not I’d be able to read through it without using the Flash development environment… Is it possible?
You’re right, I took a look at the book again, and it would be difficult to go through most of the examples without the Flash IDE. It’s certainly not impossible, but you would either have to build your libraries with a program like Swfmill or draw the graphics for your MovieClips manually and modify the code to use straight classes without calls to attachMovie.
Hopefully now that the Flex 2 compiler runs from the command line, we’ll see more resources for folks that won’t be using the Flash IDE.
I don’t know; I’ve just started using it AND just switched to flashdevelop, and so far the book still looks very helpful. But yes, what would be really fantastic is a book that uses these new tools. FlashDevelop ActionScript 3 Programming, perhaps? 🙂
Peter, I think a book about FlashDevelop would be great. Once FD3 comes out with better AS3 support, I can imagine an adventurous writer could provide a good resource for developing in AS2 and AS3 with FlashDevelop. A chapter or two about plugin development would be a nice way to get some more community involvement.