Archive

Posts Tagged ‘listener’

Listen to every mouse click in your Flex application

June 8th, 2010 Wannes No comments

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.