当我们点击数据网格单元格时,我们如何获得全局x,y位置

时间:2010-02-02 11:42:22

标签: flex

当我们点击数据网格单元格时,我们如何获得全局x,y位置。

1 个答案:

答案 0 :(得分:5)

如果您有权访问MouseEvent

//i.e., if you are inside the clickHandler(e:MouseEvent):void
trace(e.stageX + ", " + e.stageY)

否则:

var obj:DisplayObject = theDesiredObject;
var globalPoint:Point = obj.localToGlobal(new Point(obj.mouseX, obj.mouseY));
trace(globalPoint.x + ", " + globalPoint.y);