Flex中的local, content, global坐标分析
来源:互联网 发布:软件买卖网 编辑:程序博客网 时间:2024/05/29 18:33
<!-- /* Font Definitions */ @font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:SimSun;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"/@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-font-kerning:1.0pt;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-paper-source:0;}div.Section1{page:Section1;}-->
注意:以下所有global,local,content坐标都是针对于上面这个组件而言的。
以上面这个组件(组件一, comp1)这例,假如当前这个文档的这一页为舞台,那么这个组件的左上角在该页面的坐标就是该组件的global坐标.
现在假设在组件一中还有一个组件(组件二,comp2),那组件二左上角的坐标则是组件一的content的content坐标,表示的是comp2在comp1的content中的绝对位置。
Content的坐标原点不一定是在组件的原点,而是在组件的content的左上角。因此如果在comp1中添加了comp2,而且comp2的x,y都是固定的,那么comp2的左上角的content坐标在comp1的content中是不会变的,但是local坐标可能会变。因为local坐标永远是相对于comp1的左上角而言的。
<?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;
private function showSupportingArea():void
{
support.height=200;
var point:Point=new Point();
// point.x = lbl.x;
// point.y = lbl.y;
// point =lbl.localToContent(point);
// trace(point.x);trace(point.y);
// point=lbl.contentToGlobal(point);
// trace(point.x);
// trace(point.y);
point=lbl.localToGlobal(point);
trace(point.x);
trace(point.y);
// point=lbl.globalToLocal(point);
// trace(point.x);
// trace(point.y);
point=canvas.globalToContent(point);
trace(point.x);
trace(point.y);
// point=canvas.globalToLocal(point);
// trace(point.x);
// trace(point.y);
}
]]>
</mx:Script>
<mx:Button click = "showSupportingArea()" label = "Test"/>
<mx:VDividedBox id = "vbox" y = "80" height = "500" width ="100%">
<mx:Canvas id = "canvas" backgroundColor= "blue" width = "100%" height = "50%">
<mx:Label text = "Hello" id = "lbl" x = "80" y = "300"/>
</mx:Canvas>
<mx:Canvas id = "support"backgroundColor = "red" width = "100%" height = "0"/>
</mx:VDividedBox>
</mx:Application>
- Flex中的local, content, global坐标分析
- unity3d中的local和global
- Local & Global
- Flex中的CSS: (5) global与*
- global and local
- local|global index
- Global and Local Variables
- Local and Global References
- Global 和 Local 索引。
- Global and Local Variables
- Global 和 Local 函数
- Local and Global References区别
- global variable and local variable
- Global and Local Variables python
- Use Local Or Global Index?
- Local Reference and Global Reference
- unity3d的local和global
- python global and local variable
- div拖拽示例网页
- 获取GridView隐藏列
- 在Linux上交叉编译windows程序
- 让模板类支持可变模板参数
- 【转贴】Android Building System 分析
- Flex中的local, content, global坐标分析
- [QNX]对存储设备格式化
- 手机QQ2008聊天记录导入手机QQ2009 塞班第三版Python全代码 修改
- shell参数传递
- 从信息处理的角度看计算、语言和程序
- Properties探究
- Windows 2003 下 PHP5.2.5 + Apache2.2.8 + Oracle9i 的配置
- java 中乱码或者中文问题的解决
- 虚拟机Linux Redhat 9与目标开发板进行系统编程方面的问题总结(转载)