BorderContainer 背景透明一不小心就解决了!


用Group用多,感觉挺方便的,就 经常遇到 addChild, addElement 纠结性,还有图形等等;

不过后来遇上 BorderContainer,相应解决好很一些美化方面的问题,它都帮你封装好了,太爽了;

突然发发现,它本来就是白色背景的,也没设置 背景透明度的 backgroundAlpha, 查看API,原来里面有秘方:

嘿嘿,  看代码就明白了:

 1 <s:BorderContainer width="48"
 2     height="41"
 3     id="bc4"
 4     borderVisible="false">
 5     <s:layout>
 6     <s:BasicLayout clipAndEnableScrolling="true"/>
 7     </s:layout>
 8     <s:backgroundFill>
 9        <s:SolidColor 
10             color="0xffffff" 
11             alpha="0"/>
12     </s:backgroundFill>
13        <s:BitmapImage source="{d0}"
14              width="48"
15              height="83"
16              top="-42"
17             id="img4"/>
18      </s:BorderContainer>

就这段代码就可以解决 了: 其它换汤不换药,还是将背景透明度设成 0!!

<s:backgroundFill>
<s:SolidColor 
color="0xffffff" 
alpha="0"/>
</s:backgroundFill>

原文地址:https://www.cnblogs.com/dzone/p/2185118.html