0
votes

I have two sprites in my movieclip, one under the other, and i want both to listen to mouse clicks event. I found that only the top level sprite receives the event when i click on it. I need to dispatch the events on both, so I can't use mouseenabled=false.

Is there a simple workaround for this?

2

2 Answers

4
votes

Another solution is, that you listen to the click-event on the upper sprite, and fire it again with

dispatchEvent(new MousEvent(event));

Have a look at the "bubble" property of the event.

1
votes

You can use the 'getObjectsUnderPoint' method native to the DisplayObjectContainer

You can see how it works here:

http://snipplr.com/view/34945/as3-trace-movieclips-under-mouse/

and the AS3 reference here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObjectContainer.html

You would listen on the stage for any click event and if one occurs, check to see if the element you require is under that click position.