Flex显示图片的几种方式
2016-11-20 16:33
316 查看
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="init()" >
<mx:Script>
<![CDATA[
//第一种方式
[Bindable]
[Embed(source="image/aa.jpg")]
private var imgClass:Class;
private var _loader:Loader;
public function init():void
{
//第二种方式
img4.source="image/aa.jpg";
//第三种方式
_loader=new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,function(e:Event):void
{
img5.source=e.currentTarget.content;
})
_loader.load(new URLRequest("image/aa.jpg"));
//这里说一个技巧 当url 中有中文字体的话 使用encodeURI方法 如果没有 则可以不加
//_loader.load(new URLRequest(encodeURI("中国.jpg")));
}
]]>
</mx:Script>
<mx:VBox>
<!-- 第四种方式-->
<mx:Image source="image/aa.jpg" id="img" width="20%" height="20%"/>
<!-- 第五种方式-->
<mx:Image source="@Embed('image/aa.jpg')" id="img2" width="20%" height="20%"/>
<mx:Image source="{imgClass}" id="img3" width="20%" height="20%"/>
<mx:Image id="img4" width="20%" height="20%"/>
<mx:Image id="img5" width="20%" height="20%"/>
</mx:VBox>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="init()" >
<mx:Script>
<![CDATA[
//第一种方式
[Bindable]
[Embed(source="image/aa.jpg")]
private var imgClass:Class;
private var _loader:Loader;
public function init():void
{
//第二种方式
img4.source="image/aa.jpg";
//第三种方式
_loader=new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,function(e:Event):void
{
img5.source=e.currentTarget.content;
})
_loader.load(new URLRequest("image/aa.jpg"));
//这里说一个技巧 当url 中有中文字体的话 使用encodeURI方法 如果没有 则可以不加
//_loader.load(new URLRequest(encodeURI("中国.jpg")));
}
]]>
</mx:Script>
<mx:VBox>
<!-- 第四种方式-->
<mx:Image source="image/aa.jpg" id="img" width="20%" height="20%"/>
<!-- 第五种方式-->
<mx:Image source="@Embed('image/aa.jpg')" id="img2" width="20%" height="20%"/>
<mx:Image source="{imgClass}" id="img3" width="20%" height="20%"/>
<mx:Image id="img4" width="20%" height="20%"/>
<mx:Image id="img5" width="20%" height="20%"/>
</mx:VBox>
</mx:Application>
相关文章推荐
- Flex加载图片的常用的几种方式
- Android - 实现图片圆角显示的几种方式
- Flex加载图片的常用的几种方式
- Flex 显示图片的常用方式
- Flex显示图片的常用方式
- Nodejs 显示图片的几种方式
- Flex加载图片的几种方式
- flex 显示图片方式
- TextView显示带图片html的几种处理方式
- Flex加载图片的常用的几种方式
- 背景图片显示问题的几种理解方式(url与img区别)
- Flex显示图片的常用方式
- html 图片显示的几种方式
- Android实现图片圆角显示的几种方式
- Flex显示图片的常用方式
- Flex中Image加载图片出错时显示默认图片的几种方法
- Flex中Image加载图片出错时显示默认图片的几种方法
- Android中imageView中的属性ScaleType用来显示图片的几种方式
- flex下如何显示数据库中的图片
- Flex上传图片等信息到数据库,并下载显示图片