ActionScript 3.0 Bible Series at FlashCoders NY

Hey readers!

I’ve been doing a series of dynamic, engaging, interactive, educational and disturbingly sexy workshops on topics from the new AS3 Bible. These workshops are hosted by the fearless FlashCoders NY user group. If you’re in NYC and want to drop by, check the meeting announcements. Having a copy of the book isn’t required! (But I sure recommend it, duh!)

I give the workshops every other Wednesday, give or take. Tonight’s is on Pixel Bender! Be sure to stop by!

As an aside, you may be curious what I’m up to. Actually, you aren’t, but I’ll tell you anyway because I’m amped. I’m juggling several iOS projects on iPhone 4 and iPad, I’m days away from launching an amazing collaboration with artists/directors Radical Friend, the creators of openFrameworks, and the talented folks at The Science Project — an experimental art piece driven by Unity and oF. And what the hell, I’m trying to learn 3D modeling (again) (finally). I heard that I might be giving a series of iOS dev video training episodes… stay tuned if you want to hear more!

Posted in AS3, Conferences and User Groups, News | Leave a comment

FITC, Flash and the City 2010

It’s conference season. You can find me, Roger, next week at FITC Toronto 2010 or in May at Flash and the City in New York. I’ll be pimping out the new edition of the AS3 Bible, nerding out about AS3, Objective-C, and other stuff, and probably trying to squeeze in some client work if I know myself. Here is a charming photo of myself editing the AS3 Bible so you can tell who I am.

Roger editing

MIMS’s UPDATE: I’ll be at Flash and the City in May as well! You’ll be able to tell it’s me cuz I look like the picture below and I’ll probably be standing next to Roger.

Posted in Flash | Leave a comment

The New AS3 Bible

Huge news, everyone! The long-awaited (by my editors) fully-updated, fully-revised, fully-correct, fully-awesome second edition of the ActionScript 3.0 Bible is finally here, after a year of hard work. Now, I don’t have a copy yet, but apparently some of my reviewers just got their copies, and I can’t wait to see what they have to say about it. More, more, more copies should be hitting shelves now or real-soon-now.

I’ve oh-so-hastily put up a rather revolting home for the book right here at http://www.actionscriptbible.com/. There are a few small parts missing right now, and it’s ugly, so bear with me.

In any case, whether you loved or hated the last edition of the Bible, I really urge you to at least give this edition a try. I’ve completely overhauled it, rewriting hundreds of pages, and adding onto it so that it’s bleeding-edge fresh for Flash Player 10.1. How fresh is this ish? This fresh, BOOM:

  • Vectors: COVERED
  • 3d: YES
  • Pixel Bender: YOU BET
  • Flash Text Engine: FER SURE
  • Text Layout Framework: IN THERE
  • Multitouch: SO MANY TOUCHES
  • Globalization: MAIS OUI!
  • Accelerometer: HELL YAH
  • Color Correction: SURE!

What else? I’ve toiled to give you the best way to play with example code ever! And by toiled I mean “stood on MASH’s back!” Because every example in the book (save a few that need HTML features or looser security) uses the amazing Wonderfl service! First off, it’s never been easier to run example code. This is what an example looks like:

See, every example has a URL right next to it. This, Example 36-5, links right to http://actionscriptbible.com/ch36/ex5. So if you have the book open, just type in the URL and boom! You’re looking at the code, the example, you can download it, edit it, and best of all participate with the whole world in forking the code! No FTP to hit, no ZIP to download (though that’s still provided if you want), no software to setup… I’m really happy about this part of the book.

Get this; I’ve even put in a UMLesque table of contents, so you can find the chapter for the right class in a glance.

I know most of you readers are advanced AS3 developers and don’t need an introductory text. But if you need to get up to date with the latest Flash Player 10.1 features, or you want a good reference; if you’re coming from JavaScript or PHP or C# or Java; I shamelessly and unsurprisingly recommend my own book. Get it now at Amazon.

Posted in Flash | Leave a comment

Killing 3D Transforms

Here’s a quick tip. If you’ve ever dealt with 3D in Flash Player 10+ you’ll know that DisplayObjects in 3D in Flash Player are bitmap-cached; only the bitmap representation is transformed in 3D. Recently I was working on a site where objects landed on the stage, but after landing, they appeared really muddy, which was obvious when you looked at the text they contained. Even though they were completely flat, they were still using bitmap proxies! Not great.

Turning a DisplayObject into a 3D DisplayObject is as simple as assigning a value to its rotationX, rotationY, rotationZ, or z properties. But how do you turn it back? I tried giving all these properties a value of 0, but after their animations completed they were already 0. An object at z=0 still renders in 3D, using bitmap caching. Setting these values to NaN was no better.

The solution I found is to null out the 3D transformation matrix and assign a 2D transformation matrix. This can be accomplished like so for a DisplayObject named sprite:

var matrix:Matrix = new Matrix();
matrix.translate(sprite.x, sprite.y);
matrix.rotate(sprite.rotationZ);
sprite.transform.matrix3D = null;
sprite.transform.matrix = matrix;

In this code I simply drop the transformations that are inapplicable to 2D space. This is fine when your object is already coplanar with the stage.

Anyway, quick tip if this ever had you scratching your head too.

Posted in AS3, Tips, Tricks, and Hacks | 1 Comment

Side-by-side comparison shows blitting isn’t a huge speed bump

This isn’t a new article, but it touches on a topic I’ve heard a lot about recently. That is, pixel ‘blitting‘. Blitting is an old school process used in sprite-based games of essentially erasing a spot in a bitmap image based on a sprite’s alpha and using a bitwise operator to draw the sprite into that bitmap image. Most graphics systems do this transparently to the user in some fashion (pardon the pun). 8-Bit Rocket has a good introduction to these concepts with regards to Flash, but read on for the important part of this post.

Read the article on Photon Storm

The article shows that Flash Player is already fairly optimized for graphical composition operations when compared to blitting. Both showed similar framerates. However, the cacheAsBitmap operation caused an exponential increase in memory consumption when the number of sprites on stage increased. Ironically, the comparison was run by the creator of the Pixel Blitz library who, I’m sure, had a difficult time presenting the results.

There are some good details in the article so if you’re interested, read the whole thing before you decide if you agree.

Have you done any work with bit blitting or sprite sheet animation? Have you found it to be beneficial? Tell us your thoguhts.

Posted in AS3, Programming, Tips, Tricks, and Hacks, Videogames | Tagged , , , , | 2 Comments