import flash.display.Sprite; import flash.events.MouseEvent; import flash.geom.Point; var square:Sprite = new Sprite(); square.graphics.beginFill(0xFFCC00); square.graphics.drawRect(0, 0, 100, 100); square.x = 100; square.y = 200; addChild(square); square.addEventListener(MouseEvent.CLICK, traceCoordinates); function traceCoordinates(event:MouseEvent):void { //将 point 对象从显示对象的(本地)坐标转换为舞台(全局)坐标。 var squareClickPoint:Point = new Point(square.mouseX,square.mouseY); trace("display object coordinates:", squareClickPoint); var stageClickPoint:Point = square.localToGlobal(squareClickPoint); trace("stage coordinates:", stageClickPoint); //将 point 对象从舞台(全局)坐标转换为显示对象的(本地)坐标。 var _stageClickPoint:Point=new Point(mouseX,mouseY); var _squareClickPoint:Point = square.globalToLocal (_stageClickPoint); trace("display object coordinates:", _squareClickPoint); trace("stage coordinates:", _stageClickPoint); }