Reputation: 3338
Let's say there is a TOP movieclip
and another BOTTOM movieclip
How would I trigger a mouse event when the mouse is over BOTTOM even if TOP is overlaying it?
Upvotes: 0
Views: 390
Reputation: 1837
Probably this can also be the solution if you don't want your topClip mouse disabled OR if you want to receive your mouse event on both movie clips.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function onMouseOver(evt:MouseEvent):void
{
if(evt.currentTarget==bottomClip)
{
Alert.show(bottomClip+" CLICKED");
}
if(evt.currentTarget==topClip)
{
Alert.show(topClip+" CLICKED");
}
}
]]>
</mx:Script>
<mx:Canvas id="can" width="600" height="400" horizontalCenter="0" verticalCenter="0" borderStyle="solid" borderColor="red" >
<mx:Canvas id="bottomClip" click="onMouseOver(event)">
<mx:Canvas id="actualBottomClip" width="400" height="300" x="100" y="50" backgroundColor="red" />
<mx:Canvas id="topClip" click="onMouseOver(event)">
<mx:Canvas id="actualTopClip" width="200" height="75" x="50" y="100" backgroundColor="green" />
</mx:Canvas>
</mx:Canvas>
</mx:Canvas>
</mx:Application>
Upvotes: 0
Reputation: 5087
Assuming you don't want any mouse events for the top one, set mouseEnabled to false for the top clip.
topClip.mouseEnabled= false;
Upvotes: 1