View Review Details


Book:   ActionScript 3.0 Cookbook
Subject:   Strong medicine against all those unknown unknowns
Date:   2006-11-28 00:20:31
From:   Elliot Mebane
Rating:  StarStarStarStarStar

Half our battle as Flash developers is knowing where to look for fast and accurate guidance when we need it. “ActionScript 3.0 Cookbook, Solutions for Flash Platform and Flex Application Developers” by Joey Lott, Darron Schall and Keith Peters, is strong medicine against all those unknown unknowns.


The first part of the ActionScript 3.0 Cookbook covers programming essentials – loops, conditionals, functions, Numbers, Strings, Arrays, Math etc. Skipping around in the book is encouraged, but don’t discount this section just because it’s focused on the basics. Tucked away as early as page 10 you’ll get your first taste of some fundamental shifts in AS3, including changes in the way onEnterFrame, Mouse and Key events are handled and the new Timer class that replaces intervals.


AS3CB comes with a pack of useful classes to use in your everyday work. Need to duplicate a multidimensional array? Save yourself the hassle (some would say fun) of writing a recursive function and just use the “duplicate” method of the ArrayUtilities class provided with the book. Other bundled utility classes include a Pen class for drawing ellipses, triangles, polygons and arcs, and Date and Number classes for handling common numeric manipulations.


Chapter 6 pushes you into the deep end. AS3 introduces a fundamental shift in the way you put things on the stage: the Display List. The display list gets populated with Display Objects including Bitmaps, Shapes, Sprites and more.What’s a Sprite? Think of a Sprite as a MovieClip without the overhead of a timeline when you don’t need one. The new Loader class is another Display Object that works a lot like the old MovieClipLoader class for bringing external assets into your Flash projects with detailed event notification of the progress of the load.


Mouse interaction has undergone some significant changes. startDrag and stopDrag are still with us, but the AS3CB offers the DraggableSprite class for easy enhancement of mouse dragging including dragging multiple objects at once and decreased rendering lag. One of my favorite features of O’Reilly books are the “tips and traps” – little asides that keep you on track. One “trap” in this chapter cautions you to remember to set the new hitTestState or your buttons won’t be clickable. A “tip” reminds you that mouse events are generated from display objects only when the mouse is over them.


Another significant update to the language is how it handles XML. The XML chapter covers the new method for loading XML and the great new tool in AS3 for manipulating your XML objects: E4X. E4X allows you to navigate the XML tree using good ol’ dot notation instead of aggravating child node references. Sending and loading data is handled differently than in AS2: loadVars is out - URLLoader is in.


Flash users now have access to Regular Expressions to search for patterns within their text. A solid 20 pages introduce the topic, explaining the power of the cryptic strings of text that make up a Regular Expression. This is a great reference to keep on hand for brewing up your own RegExes and it offers pre-baked recipes for common RegEx activities like validating user input for email, phone numbers, dates and zip codes.


Chapters on Sound and Video cover the basics (most of which haven’t changed, barring some of the more widespread changes that come with the shift to AS3). One standout, however, is the new computeSpectrum method of the Sound object that allows you to turn a sound wave into data that can be used for visualization – now we can make graphic equalizers that actually represent the sound wave. computeSpectrum gets a snappy 2-page recipe to get you up-and-running with your own functional example to expand upon.


Even if you don’t read AS3CB from cover-to-cover, it’s worth giving it a once-over so you know what challenges you will face and can overcome when the time comes. As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns -- the ones we don't know we don't know. Don’t be a developer who doesn’t know what you don’t know.


---


Elliot Mebane is a Los Angeles Flash Application developer with a focus on Flash Video Applications and Game development. Visit www.roguish.com for more information.



See larger cover

Full Threads Oldest First