title: Mouse position on screen in flex
body: <p>I am trying to obtain the actual mouse co-ordinates on the screen so I can create a Native Window at that position but I dont seem to be able to find the right way to do this correctly.</p>
  
  <p>I have tried various things, the closest thing I have at the moment is:</p>
  
  <pre><code>this.contentMouseX and this.contentMouseY
  </code></pre>
  
  <p>This gives me the coords on the current stage which is fine, then I add to that the:</p>
  
  <pre><code>NativeApplication.nativeApplication.activeWindow.x and activeWindow.y
  </code></pre>
  
  <p>Which is close, but this doesnt take into account the application title bar.</p>
  
  <p>There must be an easier and more straightforward way of doing this I am sure, can anyone give advice cos I fail to find it on google?</p>
  
  <p>I have tried localToGlobal which doesnt work, it seems that 'global' means within the application and not global to the screen which is of no use to me. Here is an example that shows the failure...</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&gt;
      &lt;mx:Script&gt;
          &lt;![CDATA[
              import mx.core.Application;
  
              private function click(evt:MouseEvent):void
              {
                  var pt:Point = new Point( this.contentMouseX, this.contentMouseY );
                  var global:Point = Application.application.localToGlobal( pt );
  
                  trace( "local_x: " + pt.x + " x " + pt.y );
                  trace( "global_x: " + global.x + " x " + global.y );
              }
          ]]&gt;
      &lt;/mx:Script&gt;
  
      &lt;mx:HBox horizontalAlign="center" width="100%"&gt;
          &lt;mx:Button id="butt" label="Click" click="click(event)" /&gt;
      &lt;/mx:HBox&gt;
  &lt;/mx:WindowedApplication&gt;
  </code></pre>