BorderContainer中有有一个backgroundImage的属性,不能简单的这样子写:
backgroundImage="路径",应该使用Embed。
使用一些有子属性的属性,用法上有点区别。如:
<s:borderStroke>
<s:SolidColorStroke
color="#EEEEEE"
weight="4"/>
</s:borderStroke>
例子一:
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate Spark BorderContainer component -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Panel title="BorderContainer Component Example"
width="75%" height="75%"
horizontalCenter="0" verticalCenter="0">
<s:BorderContainer
backgroundAlpha="0.6"
backgroundImage="@Embed(source='QQ_L.jpg')"
backgroundImageFillMode="repeat"
cornerRadius="10"
borderAlpha="0.8"
borderStyle="inset"
borderVisible="true"
left="10" right="10" top="10" bottom="10">
<!--设置边框笔触的属性,Color、weight-->
<s:borderStroke>
<s:SolidColorStroke
color="#EEEEEE"
weight="4"/>
</s:borderStroke>
</s:BorderContainer>
</s:Panel>
</s:Application>
例子二:使用绑定
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate Spark BorderContainer component -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script>
<![CDATA[
[Embed(source="QQ_L.jpg")]
[Bindable]
private var pic:Class;
]]>
</fx:Script>
<s:Panel title="BorderContainer Component Example"
width="75%" height="75%"
horizontalCenter="0" verticalCenter="0">
<s:BorderContainer
backgroundAlpha="0.6"
backgroundImage="{pic}"
backgroundImageFillMode="repeat"
cornerRadius="10"
borderAlpha="0.8"
borderStyle="inset"
borderVisible="true"
left="10" right="10" top="10" bottom="10">
<!--设置边框笔触的属性,Color、weight-->
<s:borderStroke>
<s:SolidColorStroke
color="#EEEEEE"
weight="4"/>
</s:borderStroke>
</s:BorderContainer>
</s:Panel>
</s:Application>
注意:容器的背景图像。如果同时设置了 backgroundColor
和 backgroundImage
,则忽略 backgroundColor
。默认值为 undefined
,表示“未设置”。如果此样式和 backgroundColor
样式都未定义,则控件将采用透明背景。
更多了解点击这里:http://help.adobe.com/zh_CN/AS3LCR/Flex_4.0/spark/components/BorderContainer.html