This example shows how to get the current mouse x,y coordinate.

 

 

 

*source code :MouseLocation.fxp

 

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                     xmlns:s="library://ns.adobe.com/flex/spark"

                     xmlns:mx="library://ns.adobe.com/flex/mx"

                     width="500" height="600" backgroundColor="#BEEFFF" mouseMove="onMouseMove(event);">

       <fx:Script>

             <![CDATA[

                    /*  http://storyjava.tistory.com

                     *  code5381@hotmail.com

                     *  KevinKim

                     */           

                    private function onMouseMove(mouseEvent:Object):void

                    {

                           mouseXPoint.text = this.mouseX.toString();

                           mouseYPoint.text = this.mouseY.toString();

                    }

             ]]>

       </fx:Script>

       <s:HGroup width="100%" height="100%">

             <s:Label text="X : " />

             <s:Label id="mouseXPoint"/>

             <s:Label text="Y : " />

             <s:Label id="mouseYPoint"/>

       </s:HGroup>

</s:Application> 

 

AND