# Pixel-level collision/setPixel32 question

**URL:** https://forum.kirupa.com/t/pixel-level-collision-setpixel32-question/275865
**Category:** flash
**Created:** [November 19, 2008, 4:01pm UTC](https://forum.kirupa.com/t/pixel-level-collision-setpixel32-question/275865 "2008-11-19T16:01:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bhnh](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@bhnh](https://forum.kirupa.com/u/bhnh)
#### Post date: [November 19, 2008, 4:01pm UTC](https://forum.kirupa.com/t/pixel-level-collision-setpixel32-question/275865/1 "2008-11-19T16:01:45Z")

</div>

I’m new to Bitmap manipulation, and am (predictably:sigh:) stuck on something; basically mimicking erasing.

I’ve got a bitmap image (a .png) in the Library linked as **[COLOR=royalblue]Img[/COLOR]**. I load it onto the stage. Under the cursor the pixel alpha-value goes to zero…

```auto
var picData:BitmapData = new Img(0,0);
var pic:Bitmap = new Bitmap(picData);
addChild(pic);
addEventListener(Event.ENTER_FRAME, erase);
function erase(e:Event){
   picData.setPixel32(mouseX,mouseY, 0x00000000);
}

```

This does work. What I’d like to do is be able to drag a 20x20-pixel square around on the image and have the same erasure effect, the pixels being erased being the ones under the square. I’d guess that pixel-level collision is involved, but I’ve hit a brick wall. Any input would be greatly appreciated. Thanks!
