国产探花免费观看_亚洲丰满少妇自慰呻吟_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>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 淳化县| 唐海县| 大埔县| 莱西市| 珠海市| 石楼县| 顺平县| 岢岚县| 乌拉特后旗| 常州市| 定襄县| 黄陵县| 靖边县| 安溪县| 金湖县| 子长县| 锡林郭勒盟| 皮山县| 连云港市| 自治县| 广宁县| 元谋县| 日土县| 鸡东县| 合江县| 收藏| 大丰市| 镇江市| 安国市| 同心县| 新竹县| 宁阳县| 柏乡县| 嵩明县| 北碚区| 中超| 云和县| 利辛县| 于都县| 浦江县| 五台县|