### Archive

Archive for May, 2007

## Colin Moock Interview

You may have already seen this from Colin’s blog, but here is a great interview of Colin Moock by Mike Downey at FITC this year.  Lots of good discussion of EAS3.  Enjoy!

Categories: Uncategorized

## Record Prime Factorization

Last year, I wrote about prime factorization at the old Singularity blog.  The post included an AS 2 implementation of a textbook algorithm along with some pointers to more advanced methods such as the quadratic sieve and GNFS (General Number Field Sieve ).

A lot of work has gone into factoring numbers on the RSA Challenge List.  Now, a team including members of the University of Bonn, NTT, and Arjen Lenstra has tackled the Mersene number 2^1039 – 1.  Read more about their results here.

Categories: Math

## AS 3 Data Structures for Game Developers

Michael Baczynski recently released a library of data structures targeting game development.  I’m already interested in the BST for some work in bone animation.

Major props to Michael for releasing the library and making game development easier for all of us!

Categories: Flash, Math

## BitmapData.hitTest

Although it is pretty evident that this method does pixel-level hit testing, the documentation is pretty cryptic when it comes to *exactly* how to use the method to perform a specific test. I guess it’s one of those things that you have to figure out by looking at lots of examples. So, here is another example to throw into the mix.

I recently had to work on some code (AS2/F8) to highlight individual lines in a TextField on rollOver. Since no such method exists to do this directly, I approximated using TextField height and font metrics to create a number of ‘highlight’ boxes. One of the questions I had was how to determine if a highlight box was underneath a blank line of text.

Since I’m not directly computing the exact text in a single line, I had no way of knowing if a highlight box was underneath a ‘blank’ line. One way to find out is to take a bitmap snapshot of the TextField (actually, the MovieClip containing the TextField), a snapshot of the rectangle, then do a pixel-level hit test between the two BitmapData objects. This process is encapsulated inside a library method that should be usable in other applications.

Download the AS2/F8 example here. I hope it helps demystify BitmapData.hitTest and perhaps you can find use for this approach in another project.

Categories: Flash