package { import flash.display.*; import flash.events.*; import flash.text.*; public class Main extends Sprite { public function Main ( ) { var textfield:TextField = new TextField( ); textfield.text = "Click here"; textfield.autoSize = TextFieldAutoSize.LEFT; textfield.x = 100; textfield.y = 100; stage.addChild(textfield); textfield.addEventListener(MouseEvent.CLICK, clickListener); } private function clickListener (e:MouseEvent):void { trace("Position in TextField's coordinate space: ("+ e.localX + ", " + e.localY + ")"); trace("Position in Stage instance's coordinate space: ("+ e.stageX + ", " + e.stageY + ")"); } }}
Name (required)
email (will not be published) (required)
Website