在我的 Flex 代碼中,我有一個 Label 和一個 VGroup 容器。我想根據 Label 文本設定 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/qiye/416904.html
標籤:
