国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > WEB開發 > 正文

3.25.測量并改變容器尺寸

2024-04-27 13:51:51
字體:
來源:轉載
供稿:網友
3.25.1 問題
你需要它的根據子組件改變某個容器的尺寸。
3.25.2 解決辦法
覆蓋容器的measure 屬性,當Flex 框架調用updateDisplayList 方法的時候調用該屬性。
3.25.3 討論
無論何時,只要容器需要確定子組件有多大以及根據所有的式樣和約束信息自己有多大的時候,Flex 框架都會調用measure 方法來確定容器本身的尺寸。類似3.24 節覆蓋updateDisplayList 方法的做法,你可以覆蓋measure 方法來執行所有可能需要改變尺寸的自定義計算。
+展開
-XML
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.core.Container;
import mx.core.UIComponent;
override protected function measure():void
{
super.measure();
var childrenWidth:int = 0;
var childrenHeight:int = 0;
//loop through all children, and determine the
height and width
//of all the children components
for(var i:int = 0; i<this.numChildren; i++)
{
var obj:UIComponent = (getChildAt(i) as
UIComponent);
if(obj is Container)
{
//here we are using the viewMetricsAndPadding
//so that we get any style information
affiliated
//with the child as well as its actual width
childrenWidth +=
Container(obj).viewMetricsAndPadding.left+
Container(obj).viewMetricsAndPadding.right+obj.width;
childrenHeight +=
Container(obj).viewMetricsAndPadding.top+
Container(obj).viewMetricsAndPadding.bottom+obj.height;
}e
else
{
childrenWidth += obj.width;
childrenHeight += obj.height;
}
//set this components measured height based on our
calculations
measuredHeight = childrenHeight;
measuredWidth = childrenWidth;
}

]]>
</mx:Script>
</mx:HBox>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 昔阳县| 鄂伦春自治旗| 龙井市| 庄河市| 海安县| 怀集县| 沿河| 盖州市| 惠水县| 安塞县| 温州市| 遵化市| 辛集市| 奎屯市| 宁南县| 平利县| 桂林市| 怀宁县| 诏安县| 克东县| 德江县| 天镇县| 木里| 鄂托克前旗| 汤原县| 清苑县| 中阳县| 杭锦后旗| 息烽县| 佛冈县| 垦利县| 东兴市| 民权县| 巴林左旗| 永平县| 定襄县| 北辰区| 视频| 逊克县| 任丘市| 饶阳县|