What did I paste my code in? I didn't test your code, but at a cursory inspection, it's _very_ similar to my own! Funny. I use an EnterFrame on mouseDown, instead of a Move, but otherwise... what is different is using hitTest. I don't care if the user clicks on the bitmap... they can choose to erase or draw anywhere they like. But that's a nice option.
Currently I simply do (hardcoded 12px brush size for testing)
private function erase(e:Event):void
{
maskData.fillRect(new Rectangle(mouseX-6,mouseY-6,12,12), 0xffff0000);
}
And that does work fine. I can draw red, or transparent... However, I'd really like to use a circle instead of a rectangle.
I worked it out. Found an algorithm for drawing a filled circle pixel by pixel. Just used setPixel32 with that and I can add or subtract from the mask with varying size circular brushes. Whew.
Thanks!