Erase an image using your mouse in AS3

I recently had to create a simple Flash application that allowed the user to ‘erase’ an image using their mouse. I couldn’t find any examples of the exact effect I wanted, so I cobbled together my own. The effect I came up with is similar to using the eraser tool in Photoshop.

Demo

Click and drag your mouse on the image below to erase it. Press the reset button to start over.

Get Adobe Flash player

 

Download

Download FLA (includes code comments explaining how everything works)

Credits

My effect is based on the masking techniques shared by surferboy in an Ultrashock forum discussion and a Flash & Math tutorial explaining how to use Flash’s drawing API to draw using the mouse.

The gorgeous photographs used in this demo are by wabberjocky and ex.libris and are available under a Creative Commons license.

  • Bookmark/share this article
  • Subscribe to Pixel Acres

Comments

  • 1grabek

    Good one. congrats!

  • 2Emanuella de Oliveira

    So so cool!! Really love it!!!
    Thanks for sharing.

Add a comment

Comments are moderated, so your comment will not appear on the site immediately.

 

Pixel Acres is powered by WordPress