BorderContainer的相關屬性的運用(Flex)


BorderContainer 類定義一組 CSS 樣式,用於控制容器的邊框外觀和背景填充。

BorderContainer是一種SkinnableContainer,有邊框,可以簡單的包含子元素,支持在屏幕上定義可見的外觀。

設置BorderContainer的背景。
設置BorderContainer超出范圍不顯示:
BorderContainer繼承自SkinnableContainer,這兩個組件都不是自身添加顯示對象的,而是使用contentGroup作為子內容的容器,而contentGroup實際上是一個Group對象
Group本身有一個屬性:clipAndEnableScrolling,當它為true時,就會裁剪內容,默認是false
 
例1代碼:
<? xml version = "1.0" encoding = "utf-8" ?>
< s : Application xmlns : fx = "http://ns.adobe.com/mxml/2009"
          xmlns : s = "library://ns.adobe.com/flex/spark"
          xmlns : mx = "library://ns.adobe.com/flex/mx"
          width = "400" height = "200" >
< fx : Declarations >
    <!-- 將非可視元素(例如服務、值對象)放在此處 -->
</ fx : Declarations >
< s : BorderContainer id = "my123" width = "400" height = "200"
                backgroundImage = "@Embed(“背景圖片路徑”)"
                backgroundImageFillMode = "repeat"
         cornerRadius = "10"
                creationComplete = "my123.contentGroup.clipAndEnableScrolling=true" >
   
    < mx : DateChooser x = "-77" y = "-2" />
    < mx : DateChooser x = "175" y = "0" height = "192" />
</ s : BorderContainer >

</ s : Application >

例2:
<s:BorderContainer id="bar" width="100%" backgroundAlpha="0.5" backgroundColor="#CFCFCF"
        borderVisible="false" dropShadowVisible="true" verticalCenter="0"
        height.ready="140"
        height.start="1">
  <s:Group id="loginbox" includeIn="ready" width="100%" height="100%">
       <s:Label y="28" fontWeight="bold" horizontalCenter="-91" text="用戶名:"/>
  </s:Group>
</s:BorderContainer>
常用屬性:

1.backgroundImageFillMode
如果在 ActionScript 中設置此屬性的值,則使用該常量(如 BitmapFillMode.CLIP)。

設置為 BitmapFillMode.CLIP(“clip”)時,圖像在區域的邊緣處結束。

設置為 BitmapFillMode.REPEAT(“repeat”)時,位圖將重復以填充區域。

設置為 BitmapFillMode.SCALE(“scale”)時,圖像將拉伸以填充區域。

2.backgroundImage

背景圖片

3.backgroundColor

背景顏色

4.borderVisible

確定邊框是否可見。如果為 false,則除了使用 borderStroke
屬性設置的邊框可見外,其他邊框均不可見。

5.dropShadowVisible

如果為 true,則容器包含可見投影

 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM