what you want to do is look into the threshold(); method of the bitmapData Class in the Flash help files.

zlatan