Foundation ActionScript Animation

12 comments | Posted: 30 January 06 in Books, by Nathan Smith

Foundation ActionScript Animation I just finished reading through Foundation ActionScript Animation, and all I can say is: Wow. Remember as a kid when your math teachers told you that you’d be able to actually use all that stuff someday? They weren’t joking. Keith Peters has jam-packed this book with just about everything you’d need to know in order to animate things in Flash using pretty much pure ActionScript code.

One of my coworkers told me this book was going to be good, having only seen the author’s name. They had each contributed to the book Byte Sized Flash several years ago. From the listing on Keith’s site, he’s been incredibly busy writing books since then. I was completely mezmorized by some of the things possible in Flash today, and appreciated the straightforward style of the text.

If the reference to math scared you off, you’re in good company. I always loved the spatial reasoning aspects of math classes, but never much cared for the word problems. I mean, if two trains are passing each other, why do we need to know the exact time at which they pass? Clearly they’re not going to hit each other, and you don’t have enough time to wave to anyone as they zip by!

My point is, the author makes you aware early on that ActionScript is more visual than it is verbal. He says it best on page 42:

The funny thing is that in programming with trigonometry, you are hardly dealing with numbers at all. It’s far more in the realm of visualizing shapes and relationships.

I can attest that most of the book is about how to set up your ActionScript with variables, so that you can easily manipulate your effects based on entering a few values once the rest of the code is in place. Think of it as the way that CSS is used to separate presentation from structural markup. We plug in our numerical values to a value-less code snippet based on ratios / rhythm, and then it springs to life. That’s a little over-simplified, but you get the point.

I even learned some new jargon to throw around the office. For instance, did you know that a twip is the word for 1/20th of a pixel? Yeah, me neither. This is how intricately Flash calculates movement and positioning, at a sub-pixel level.

In earliest chapters, Keith covers the basics of drawing shapes and creating movements, but it’s in the later chapters that this book really shines. He delves into the tenets of physics, and how to mimick these aspects in Flash. On page 237, he gives a great explanation of mass, velocity and momentum…

“Something with a small mass and high velocity could have a similar momentum to something with a large mass and low velocity. [A] large truck moving at a mere 20 miles per hour could easily kill you. A bullet, on the other hand, has a relatively tiny mass but a much higher velocity, and it’s just as deadly.

By far my favorite chapter was 16. You may or may not know that while in college, I made several video game levels for first-person shooters (screenshot). This chapter took me back. It shows how to create complex polygons, via floating point defenitions, matricies and mimicking extrusion.

If you’ve done any sort of 3D modeling / game mapping, you will know what I mean. If not, then take a look at this picture of an old Superman comic. Normally, text is 2D, but py “smearing” or pushing it out, that is an extrusion. You could think of it like many paper snowflakes stacked on top of each other.

He also shows how to cut up surfaces, called “cleaving” in gaming lingo. Basically, it’s a way of choosing existing points on an object, and then passing straight lines through to other points. Eventually, you have an object comprised entirely of triangles. Since this is nature’s most simple 2D form, it is the most efficient way for a computer to render surfaces in a psuedo 3D environment. When you see a video card on sale, and it boasts how many polygons it can draw on-screen per second, this is the measure to which they are referring.

Anyway, I could go on and on, but as was mentioned earlier, the biggest appeal of this book is the wealth of code examples, and the down to earth writing style. He takes large problems and by chunking them into smaller ones, helps you to logically progress from wondering “what if” to actually realizing the solution in code. In the author’s own words from the intro…

This book’s greatness has nothing to do with my writing ability, personality, or anything else about me. I consider it great because of the subjects it covers. This is the book I’ve been looking for since 1999. If someone else had written it back then, I would have bought it, read it, and called it a great book, and that would be the end of the story. But since nobody seemed to be stepping up to the task, I decided to do it myself.

I don’t think he gives himself enough credit. Yes, this is a great book, but I think it’s largely because Keith Peters is a great author. Suffice it to say, I’m glad he stepped up to the task to write such a thorough guide to ActionScript.

Discuss This Topic

  1. 1 Yannick

    Hmmm…I guess my math teachers were right then.

    Sounds like a good one. Thanks for the review Nathan.

     
  2. 2 Mark Priestap

    I’m not a Flash guy per-se, but you’re making me drool. Sometimes I wonder if I don’t like flash because I can’t do it very well. LOL.

     
  3. 3 Yannick

    Mark: I think to an extent I feel the same way. Added to that there are so many other things I’d like to learn that I think I’m all confused now and don’t know which to actually get into. :)

     
  4. 4 Nathan Smith

    “I’m all confused now and don’t know which to actually get into.” – Yannick
    ~ You and me both, bro. :)

     
  5. 5 Mark Priestap

    Yup. That about sums it up Yannick. DOM Scripting is another fascinating one. My pastor gave me a great piece of advice lately: Do what you do really well and hire someone to do the stuff you don’t do very well. Seems like common sense, is more difficult in practice to restrain yourself. Keep your chin up bro, you’re immensely talented with a bright future.

     
  6. 6 Yannick

    Thanks Mark. You too man.

    Nathan: Is actionscript pretty easy to learn? Is it similar to any other languages out there?

     
  7. 7 Nathan Smith

    Yannick: The structure of ActionScript is based around the way that JavaScript works. So, if you learn one, the jump to the other is a bit easier. It’s a trade-off, really. To learn JavaScript, you put up with browser inconsistencies, whereas to learn ActionScript, you have to shell out cashola for Flash Pro.

     
  8. 8 Robert

    Another great review Nathan! You got me soo jealous with you receiving free books to review! :D

    BTW, I have one chapter left in DOM Scripting book by Jeremy Keith. It is quite a good read. Now all I got to do is write a review and beg for free books to review. :D

     
  9. 9 beth

    I think a lot of people severely underestimate the power of ActionScript when used for good. I’m glad to see books like this are coming out demonstrating all the wonderful things you can do, that don’t include pop-ups haha.

     
  10. 10 TimK

    I’ve spent a fair amount of time in actionScript but I’ve recently been yearning to learn how to do the “Ken Burns Effect” really well in flash 8.

    Is this the book for me??

    fyi if not familiar with the ken burns effect… http://en.wikipedia.org/wiki/Ken_burns_effect#Ken_Burns_Effect

     
  11. 11 Nathan Smith

    TimK: This probably isn’t the best book for that effect, since it deals less with artistic effects, and more with complex motion based on physics and math principles. You might want to try another recent book: Flash 8 Essentials.

     
  12. 12 Yannick

    I get ya. Thanks for the explanation Nathan.

     

Comments closed after 2 weeks.