views:

1746

answers:

5

Hi,

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.

A: 

I think I stumbled upon similar problem, although in as2.

In flash when you position movie clip over movie clip, and the movie clip on the top has any mouse events implemented, it captures all mouse events so they never reach occluded movie clip.

The solution is not to have any mouse events for the top movie clip and have the movie clip positioned at the bottom capture mouse event and redirect some of them to the top movie clip (you can check mouse position with hitTest to determine if they should be redirected).

Kamil Szot
A: 

You can always attach a Mouse Click listener to the container, and then either use GetObjectsUnderPoint and check for your object or do a hit test and see if the mouse position is over your intended object.

The hit test would look something like this !this.YourPhoto.hitTestPoint(stage.mouseX, stage.mouseY, false)

b

WillyCornbread
A: 

Take a look at what senocular does here, specifically in the handleUpdate method. Basically: getting a list of everything under the mousePoint to find your object.

jedierikb
+1  A: 

How about this?

mask.mouseEnabled = false;

Amarghosh
A: 

If I understand your problem, this handy class should solve it: http://www.mosessupposes.com/utilities/InteractivePNG.html

Tim Scollick