Something Wrong with the System

A Flash/Actionscript blog

pixelStorm ver.2 (.swf with Source)

Ok, my first AS3 post.

This week I went to FITC. I had a really good time, I went to a bunch of really interesting sessions, got drunk at the open bar and hung out with Grant Skinner for a while. Good times.

The important thing I learned from FITC is that: A) I should do more experimental work B) I have to start a blog so I can share my work with others.

So, here it is. My first post-FITC AS3 code post! I call it pixelStorm (sounds like a straight to VHS movie circa Lawn Mower Man)

I got the idea from GMUNK’s session: He mentioned a rejected project where words would appear on screen one pixel at a time.

Click to see the swf and download the source.

You can control the pixel source by moving your mouse around. Restart the ‘pixel storm’ by clicking.

Essentially, I'm creating a giant 256x256 array. With colour and end position for every pixel in an image.

pixelArray.push([bitmapAlias.getPixel32(sampX, sampY), sampX, sampY]);

Once that array is put together I animate each particle one at a time and map it's current position on a bitmapData with setPixel().

Once the pixel has reached its destination I lock the pixel's position on a second bitmap and move the particle into the available particle pool so it can be reused.

lockedBitmapData.setPixel(aPart.x, aPart.y, aPart.colour);
var outParticle:partycle = activeParticles.splice(i, 1)[0];

You can find the source here:

Today, I realized I could code this without first pushing 65k pixels into an array. Instead I can just sample the pixels from the source image in real time. During Grant Skinner's FITC talk I learned that the bitmapData object is a very fast integer typed array. That would make everything much faster (I hope). Maybe I'll try it out later!

If you found this at all helpful, tell your friends or leave a comment 😀 I'd to be nice to know someone gives a shit!

April 27th, 2008 by admin
Posted in AS3, Programming

3 Responses to “pixelStorm ver.2 (.swf with Source)”

  1. Sean Says:

    Nice one! I forgot about that BitmapData tip. Thanks for the reminder.

  2. Anya Says:

    I love this one too… now I need one of Wynnie. 🙂

  3. Peter Organa Says:

    Well, if you want one of your dog you could download the source, and just swap out the image. It’s just there as a .png