0
在下面的代碼,當我的hbox的寬度更多然後vbox滾動條出現,但填充底部disaaper,所以我想確定惠特vbox有hscrollbar或不。 哪些屬性或方法的vbo shouid我檢查確定?將horizontalscrollpolicy設置爲auto後,如何確定vbox是否具有滾動條?
我想在圖像2相同填充如圖1
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function updateScrollPosition():void {
vSP.text = vBox.verticalScrollPosition.toString();
mVSP.text = vBox.maxVerticalScrollPosition.toString();
}
]]>
</mx:Script>
<mx:Style>
VBox {
paddingLeft: 10;
paddingRight: 10;
paddingTop: 10;
paddingBottom: 10;
}
</mx:Style>
<mx:ApplicationControlBar dock="true">
<mx:Form>
<mx:FormItem label="verticalScrollPolicy:">
<mx:ComboBox id="comboBox">
<mx:dataProvider>
<mx:Array>
<mx:Object label="auto" />
<mx:Object label="on" />
<mx:Object label="off" />
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="height:">
<mx:HSlider id="slider"
minimum="50"
maximum="300"
value="50"
liveDragging="true"
snapInterval="1"
tickInterval="50" />
</mx:FormItem>
<mx:FormItem label="verticalScrollPosition:">
<mx:Label id="vSP" />
</mx:FormItem>
<mx:FormItem label="maxVerticalScrollPosition:">
<mx:Label id="mVSP" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:VBox id="vBox"
horizontalScrollPolicy="{comboBox.selectedItem.label}"
backgroundColor="haloSilver"
verticalAlign="middle" horizontalAlign="center"
height="50"
width="200"
paddingLeft="10" paddingRight="10" paddingBottom="10" paddingTop="10"
updateComplete="updateScrollPosition();"
creationComplete="updateScrollPosition();">
<mx:HBox id="box"
backgroundColor="haloBlue"
width="{slider.value}"
height="100%" verticalAlign="middle" horizontalAlign="center"
>
<mx:VBox height="12" width="12" borderStyle="solid" backgroundColor="red"/>
<mx:Label fontSize="13" text="Label 13"/>
</mx:HBox>
</mx:VBox>
</mx:Application>
我已經試過這段代碼,但它不工作 – 2012-08-01 12:19:22