在我的 Flex 代碼中,我有一個 Label 和一個 VGroup 容器。我想根據標簽文本設定 VGroup 的高度。
這是簡化的代碼 -
<s:Group height="100%" width="100%" >
<s:Group id="titleBar" width="100%" depth="50" >
<s:Label id="titleDisplay" maxDisplayedLines="1"
color="{ColorMap.WHITE}"
color.bubble="{ColorMap.MAINTEXT}"
color.inactiveGroup="{ColorMap.MAINTEXT}"
left="10" right="35" top="1" bottom="0" minHeight="30"
verticalAlign="middle" textAlign="left"
styleName="overlayTitle"/>
</s:Group>
<s:VGroup width="100%" height="{(titleDisplay.text == "Create Pool")? "80%" : "100%"}" top="30">
<s:Group id="contentArea" width="100%" height="100%">
....
</s:Group>
</s:VGroup>
</s:Group>
所以如果標簽的文本是“創建池”,我想將高度設定為 80%,否則設定為 100%。但是我從 VGroup 行收到以下編譯錯誤 -
Element type "s:VGroup" must be followed by either attribute specifications, ">" or "/>".
如何解決這個問題?我正在關注以下鏈接中的代碼 - 如何在 Flex 中使用兩個運算式(案例)撰寫行內條件陳述句?
請指導我如何在這種情況下放置條件陳述句。
謝謝
uj5u.com熱心網友回復:
我用自定義函式 init() 解決了這個問題。
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="init()">
private function init():void
{
if (titleDisplay.text == "Create Pool")
{
contentVGroup.height = contentVGroup.height * .8;
}
}
這是完美的作業。
謝謝
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/338347.html
標籤:actionscript-3 apache-flex flex4.5 xml文件
上一篇:過濾第一個多對多專案的查詢
