Search code examples
apache-flexactionscript-3mxml

Click-outside event on custom components in flex


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.


Solution

  • You can use the FlexMouseEvent.MOUSE_DOWN_OUTSIDE event. For example:

    myPopup.addEventListener(
       FlexMouseEvent.MOUSE_DOWN_OUTSIDE,
       function(mouseEvt:FlexMouseEvent):void
       {
           PopUpManager.removePopUp(myPopup);
       }
    );