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

首頁 > 網(wǎng)站 > WEB開發(fā) > 正文

3.25.測量并改變?nèi)萜鞒叽?/h1>
2024-04-27 13:51:51
字體:
供稿:網(wǎng)友
3.25.1 問題
你需要它的根據(jù)子組件改變某個容器的尺寸。
3.25.2 解決辦法
覆蓋容器的measure 屬性,當(dāng)Flex 框架調(diào)用updateDisplayList 方法的時候調(diào)用該屬性。
3.25.3 討論
無論何時,只要容器需要確定子組件有多大以及根據(jù)所有的式樣和約束信息自己有多大的時候,F(xiàn)lex 框架都會調(diào)用measure 方法來確定容器本身的尺寸。類似3.24 節(jié)覆蓋updateDisplayList 方法的做法,你可以覆蓋measure 方法來執(zhí)行所有可能需要改變尺寸的自定義計算。
+展開
-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>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴文县| 灵石县| 绿春县| 隆德县| 衡山县| 蛟河市| 上杭县| 报价| 漳州市| 苗栗市| 双鸭山市| 明光市| 蓬莱市| 清新县| 南川市| 邵东县| 临汾市| 山阴县| 怀来县| 盐津县| 温州市| 定州市| 威远县| 通许县| 宿州市| 建始县| 兴安盟| 五大连池市| 福州市| 伊宁县| 聂荣县| 吉隆县| 子洲县| 佛坪县| 松桃| 武山县| 周至县| 全椒县| 茌平县| 蓬溪县| 察哈|