Home > Coding tips, Flex > Listen to every mouse click in your Flex application

Listen to every mouse click in your Flex application

Sometimes you need to know when there is a mouse click in your Flex application.
Instead of listen to all the components you just can add the next listener:

systemManager.getSandboxRoot().addEventListener(MouseEvent.CLICK, onApplicationMouseClick);

private function onApplicationMouseClick(event:MouseEvent):void
{
     //your code
}

Note: When the user prevents the default behaviour (event.preventDefault) of a mouse click event, the code above will not be triggered.

  1. No comments yet.
  1. No trackbacks yet.
Security Code: