Is there a way to write a custom event that gets triggered when the user clicks outside of that custom component instance? Basically anywhere else in the main flex app. Thanks.
+1
A:
You can use the FlexMouseEvent.MOUSE_DOWN_OUTSIDE
event. For example:
myPopup.addEventListener(
FlexMouseEvent.MOUSE_DOWN_OUTSIDE,
function(mouseEvt:FlexMouseEvent):void
{
PopUpManager.removePopUp(myPopup);
}
);
Jacob
2009-07-18 16:18:40
the FlexMouseEvent.MOUSE_DOWN_OUTSIDE is however just broadcast if you add the component with the popupmanager, not if you do a manual addChild (see http://www.mail-archive.com/[email protected]/msg14875.html and see my last hour of hair-pulling)
iddqd
2010-03-18 17:04:40
A:
stage.addEventListener( MouseEvent.CLICK, stgMouseListener, false, 0, true );
...
private function stgMouseListener( evt:MouseEvent ):void
{
trace("click on stage");
}
private function yourComponentListener( evt:MouseEvent ):void
{
trace("do your thing");
evt.stopPropagation();
}
jedierikb
2009-07-18 16:19:43