flex 组件绝对位置

private function getUiAbsolutePosition(ui:UIComponent):Point//获取组件的绝对位置
{
var point:Point=new Point();
    point.x=ui.x;
    point.y=ui.y;
var temp:DisplayObject=ui;
do
{
  var parent:UIComponent=temp.parent;
  if(parent!=null)
  {
  point.x+=parent.x;
  point.y+=parent.y;
  temp=parent;
  }
 
}while(parent!==this.parentApplication && parent!=null )

return point;
}

你可能感兴趣的:(UI,Flex)