Break a bitmap into a grid with ActionScript 3

December 27th, 2009

I needed a way to break apart a loaded bitmap into a grid of smaller bitmaps so I could then manipulate them separately. I ended up creating BitmapGrid.as, a class that will break apart your bitmaps into an array for you to do with as you please.


The Flash plugin is required to view this object.

Download the code & example files

2 Comments »

  1. This is pretty sweet! It might be nice, though, if the spacing weren’t applied to the last column like that. Also, if the function returned a multidimensional array so you could do something like result[x][y], instead of having to figure out the index of the position you want. In any case, I can think of a lot of places where this will come in handy.

    Comment by matthew — December 28, 2009 @ 9:04 am

  2. Also, if the function returned a multidimensional array so you could do something like result[x][y]

    I will implement that, should be pretty easy.

    Comment by admin — December 29, 2009 @ 8:36 am

RSS feed for comments on this post. TrackBack URI

Leave a comment