Bitmap Eraser

[LEFT]I’m trying to make an AS3 version of senocular’s Erase and Redraw I’ve gone over the code and converted it over to AS3. It all seems pretty straight forward. My problem is when I draw with the eraser it erase’s with the entire bitmap shape not just the alpha. I can not figure out why.

The below code creates the actual eraser bitmapData. A white square with a transparent circle.

var eraser:BitmapData = drawEraser();

        private function drawEraser():BitmapData {
            var diamX:int = 50;
            var diamY:int = 50;
            // Below creates a black circle that will be the eraser's shape.
  , 1);
            // New bitmapData created and filled with white.
            var eraserShapeBMD:BitmapData = new BitmapData(diamX, diamY, true, 0);
            eraserShapeBMD.fillRect(eraserShapeBMD.rect, 0xFFFFFFFF);
            // Copy the black brush shape to the bitmapData object. Image will then be a black circle on a solid white background.
            // Copy the red channel to the alpha channel. This leaves a solid white square with a transparent circle.
            eraserShapeBMD.copyChannel(eraserShapeBMD, eraserShapeBMD.rect, zeroPoint, BitmapDataChannel.RED, BitmapDataChannel.ALPHA);
            return eraserShapeBMD;

The below function is triggered when the mouse is pressed and moves.

private function drawPoint (xMouse:int, yMouse:int):void {            

    var zeroPoint:Point = new Point(0,0);
    selectedLayer.bitmapData.copyPixels(selectedLayer.bitmapData, eraser.rect, new Point(xMouse-eraser.width/2, yMouse-eraser.height/2), eraser, zeroPoint, false);

Any help would be great.