For a drawing program made in flash, i came across the need to erase a bitmapData object using a custom brush tip. Finally i came across this example which was exactly what i needed, except it was written for actionscript 2.
I updated the script to actionscript 3, and added some extra comments that made me understand how this worked. I hope it saves you some time if you need to do something similar. (Please forgive the roughness of the code, its just a test for learning porpouses)
type="application/x-shockwave-flash">

