-
Notifications
You must be signed in to change notification settings - Fork 0
Flex measure深入
ythy edited this page Jan 8, 2018
·
1 revision
-
width
: 组件的宽度,有可能是显式设置的lbl.width = 100
,也有可能是测量的lbl.setActualSize(100, xx)
-
measuredWidth
: 组件的默认宽度,在绘制周期的measure()
方法里设置 -
ExplicitWidth
: 组件的显示宽度,通过lbl.width = 100
设置,否则是NaN
-
getExplicitOrMeasuredWidth()
: 返回组件的ExplicitWidth
||measuredWidth
-
measure()
阶段如果组件在createChildren()
没有显示设置宽度,lbl.width
在测量之前是0, 应当取measuredWidth
-
updateDisplayList()
阶段实例
trace(btn.height + " " + btn.getExplicitOrMeasuredHeight()) ;
btn.height = 50;
trace(btn.height + " " + btn.getExplicitOrMeasuredHeight()) ;
输出为
0 22
50 50
trace(btn.height + " " + btn.getExplicitOrMeasuredHeight()) ;
btn.setActualSize(100, 50)
trace(btn.height + " " + btn.getExplicitOrMeasuredHeight()) ;
输出为
0 22
50 22
说明 显式或测量设置高度,都会改变组件的高度,显示设置高度后getExplicitOrMeasuredHeight()
返回值对应发生变化
tell me how get back to sunshine