BorderContainer的相关属性的运用(Flex)

BorderContainer 类定义一组 CSS 样式,用于控制容器的边框外观和背景填充。

BorderContainer是一种SkinnableContainer,有边框,可以简单的包含子元素,支持在屏幕上定义可见的外观。

设置BorderContainer的背景。
设置BorderContainer超出范围不显示:
BorderContainer继承自SkinnableContainer,这两个组件都不是自身添加显示对象的,而是使用contentGroup作为子内容的容器,而contentGroup实际上是一个Group对象
Group本身有一个属性:clipAndEnableScrolling,当它为true时,就会裁剪内容,默认是false
 
例1代码:
<?xmlversion="1.0"encoding="utf-8"?>
<s:Applicationxmlns: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:BorderContainerid="my123"width="400"height="200"
                backgroundImage="@Embed(“背景图片路径”)"
                backgroundImageFillMode="repeat"
         cornerRadius="10"
                creationComplete="my123.contentGroup.clipAndEnableScrolling=true">
   
    <mx:DateChooserx="-77"y="-2"/>
    <mx:DateChooserx="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,则容器包含可见投影

 
 

posted on 2013-03-27 16:03  笔墨丹青  阅读(6726)  评论(0)    收藏  举报

导航