How to click through a display object in Flash with AS3?

picardo picture picardo · Sep 2, 2009 · Viewed 19.8k times · Source

I am creating a photo editor app where, at some point, the photo you edit is supposed to be dropped between two layers of DisplayObjects (a background image and an image mask.)

There is a problem, though. When the image you are editing is dropped between the background and the image mask layers, it becomes unclickable, and therefore gets stuck there, with no chance of dragging it again. (The photo editor uses TransformManager library.)

I am looking for a way to allow you to select the image you are editing no matter if there is another DisplayObject on top of it. And that probably means finding some way to click through the image mask.

Is there a way to do that?

I tried setting mouseChildren = false on imageMask, but that didn't have the desired effect.

Many thanks.

Answer

Poppe76 picture Poppe76 · Jun 26, 2011

I had similar problems and I managed to solve it by using both

 displayobject.mouseChildren = false;  

and

displayobject.mouseEnabled = false;  

on the object that you want to click through.