flex图片背景平铺

<mx:Image width="100%" height="100%" scaleContent="false" source="assets/icons/ai.jpg" maintainAspectRatio="false" mask="" smoothBitmapContent="true" />
smoothBitmapContent 平滑处理图片,这样至少在缩小的时候不会失真,放大的时候有可能会失真
scaleContent false会按照原图加载,不够大小会进行裁剪  true根据width和height最小的一个进行原图比例缩放
maintainAspectRatio  是否按照原图比例缩放
mask 指定的mask对象遮罩
flex4中有三种方法可以实现图片平铺为背景
1.
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";

.mybackground {
font-size:14;
background-image:Embed("assets/images/w_bg.png");
background-position:right,bottom;
background-blend:multiply;
background-size:"100%";
backgroundImageFillMode: repeat;
}
</fx:Style>

2
<s:Graphic id="bg">
<s:BitmapImage
source="@Embed('assets/images/w_bg.png')"
width="120"
height="120"
fillMode="repeat"/>
</s:Graphic>
3
<s:Image includeIn="login" source="assets/images/main.jpg" width="100%" height="100%" scaleMode="stretch" smooth="true"/>
smooth属性,平滑处理图片

猜你喜欢

转载自jie66989.iteye.com/blog/1754294