Tuesday, July 13, 2010

X ,Y Values

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"   layout="absolute" >
<mx:Script>
<![CDATA[
import mx.containers.Canvas;
public function add(event:MouseEvent):void
{
xpo.text=(event.currentTarget as Canvas).mouseX.toString();
ypo.text=(event.currentTarget as Canvas).mouseY.toString();
}
]]>
</mx:Script>
<mx:Canvas backgroundColor="#ffffff" mouseMove="add(event);" x="20" y="227" width="775" height="278">
</mx:Canvas>
<mx:TextInput id="xpo" x="47" y="8" width="51" editable="false"/>
<mx:TextInput id="ypo" x="47" y="38" width="51" editable="false"/>
<mx:Label x="22" y="10" text="X:" fontWeight="bold" fontSize="12"/>
<mx:Label x="22" y="40" text="Y:" fontWeight="bold" fontSize="12"/>
  
</mx:Application>


SCREEN SHOT &   DEMO HERE



















No comments:

Post a Comment