Grafting Shapes on Type #1

Had this sudden urge to map or graft shape onto type. The gist of it is to draw a source display object or bitmap into a BitmapData object. Create a virtual grid and sample the center of any grid unit. If the center yields a black pixel, map something at those coordinates. Lots of optimization to get it to run this fast. Of special note is:
//faster than addChild(something)
addChildAt( something, 0 );

The speed difference is around 4x. It works best if you add it at position 0 though using an index is still faster than addChild.

Download Commented Source


About this entry