flex AIR读取本地资源
来源:互联网 发布:匿名者黑页源码 编辑:程序博客网 时间:2024/06/05 14:29
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
private var file:File;
private var imageTypes:FileFilter;
private function creationCompleteHandler(event:Event):void
{
file = new File();
imageTypes = new FileFilter("Images (*.png, *.cba)",
"*.png; *.cba;")
//增加当打开浏览文件后,用户选择好文件后的Listener
file.addEventListener(Event.SELECT, selectHandler);
}
private function selectHandler(event:Event):void
{
path.text = (event.currentTarget as File).url;
//增加一个文件加载load完成后的listener
file.addEventListener(Event.COMPLETE, onLoadComplete);
file.load(); //加载用户选中文件
}
private function onLoadComplete(event:Event):void
{
imgPhoto.source = file.data;
}
private function browseHandler(event:Event):void
{
//打开浏览文件的dialog
file.browse([imageTypes]);
}
]]>
</fx:Script>
<mx:Image id="imgPhoto" visible="true" x="58" y="59" width="228" height="226" autoLoad="true"/>
<mx:Button id="btnBrowse" x="342" y="10" label="Browse" click="browseHandler(event)"/>
<s:TextInput id="path" x="10" y="9" width="328"/>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
</s:WindowedApplication>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
private var file:File;
private var imageTypes:FileFilter;
private function creationCompleteHandler(event:Event):void
{
file = new File();
imageTypes = new FileFilter("Images (*.png, *.cba)",
"*.png; *.cba;")
//增加当打开浏览文件后,用户选择好文件后的Listener
file.addEventListener(Event.SELECT, selectHandler);
}
private function selectHandler(event:Event):void
{
path.text = (event.currentTarget as File).url;
//增加一个文件加载load完成后的listener
file.addEventListener(Event.COMPLETE, onLoadComplete);
file.load(); //加载用户选中文件
}
private function onLoadComplete(event:Event):void
{
imgPhoto.source = file.data;
}
private function browseHandler(event:Event):void
{
//打开浏览文件的dialog
file.browse([imageTypes]);
}
]]>
</fx:Script>
<mx:Image id="imgPhoto" visible="true" x="58" y="59" width="228" height="226" autoLoad="true"/>
<mx:Button id="btnBrowse" x="342" y="10" label="Browse" click="browseHandler(event)"/>
<s:TextInput id="path" x="10" y="9" width="328"/>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
</s:WindowedApplication>
阅读全文
0 0
- flex AIR读取本地资源
- air读取本地资源文件
- Flex AIR 读取本地图片并得到读取图片的Bitmap对象
- Flex AIR 读取本地图片并得到读取图片的Bitmap对象
- Adobe AIR/Flex 资源汇总
- 读取Flex AIR应用程序设置
- flex air 本地窗口基本操作
- flashcs3,Flex-AIR相关资源下载
- Flex及AIR开发资源下载
- Flex AIR
- Unity读取本地图片资源
- Unity读取本地图片资源
- Unity读取本地图片资源
- Adobe AIR读取本地外部SWF文件的功能概览
- flex, swf 不能访问网络/本地资源
- Flex的读取本地XML文件方式
- Flex及AIR开发资源下载(6月12日更新,含FLEX 3 BETA)
- WP7 读取本地资源文件如xml
- 贝叶斯分类器
- Cookie/Session机制详解
- JavaScript HTML DOM常用语法
- ConfigReader(十四)—— ReadGuideHelpConfig
- MySQL系列之源码浅析
- flex AIR读取本地资源
- iOS-获取手机健康步数,去除人为添加的数据
- 常用开发工具
- Spark基础随笔:Spark1.6 Idea下远程调试的2种方法
- springboot bean 注解绑定
- SQL生成临时表id自增列
- c++ vector容器
- php操作redis常用方法及代码实例
- sql 布尔盲注 python脚本实现