Erasing BitmapData using a mask

Hey all,

I’m having a hard time figuring this out. Here’s what I’m trying to do: I have one BitmapData object (let’s call it “baseTile”) which represents the room the player is in. This BitmapData starts off as more or less a solid color. I also have other BitmapData objects (“maskX”) which have the same dimensions as baseTile which contain the shapes of various rooms.

What I want to do is erase the level outline in maskX from the baseTile. Here’s a link to an image to show what I’d like: http://i.imgur.com/yAMJm.png

I’m not really sure how to go about getting this accomplished. I’m going to guess it has to do with either BitmapData.copyPixels() using the mergeAlpha setting or BlendMode.ERASE. I’m just not sure how to get started.