- 浏览: 135872 次
- 性别:
- 来自: 重庆
文章分类
最新评论
-
zhengjb:
我晕,BitmapBytes类没找到!
Flex 图片压缩、上传 -
aniyo:
恩,学习了,原来只知道like只能用$$钱钱这个,不知道还可以 ...
ibatis sqlMap.xml 文件 like 查询的三种方案 -
slang88:
很好用。拿走了、谢谢LZ
Flex 饼形图 piechart 柱形图 columnchart 条形图 barchart 折线图 linechart -
liuyuan0371:
...
Flex 上传图片 预览 加载图片到内存 -
huangtaodada:
就要 这功能
Flex 饼形图 piechart 柱形图 columnchart 条形图 barchart 折线图 linechart
下面的实例演示了Flex中的 FileReference 类的基本用法,允许用户从服务器上下载一个文件。这个例子也演示了你可以在 DataGrid组件中显示数据提示(data tips) ,只要把 data grid column 的 showDataTips 属性设置为 true ,然后把 column 的 dataTipField 设置一个值就行了。
在下边的演示中,当用户点击按钮的时候会下载一个 zip 文件 ,然后你可以把鼠标移到 DataGrid 组件的 Type 列上,来看额外的 Event 信息。
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init();"> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import flash.net.FileReference; [Bindable] [Embed('assets/disk.png')] private var diskIcon:Class; [Bindable] private var arrColl:ArrayCollection; // 要下载文件的URL private const FILE_URL:String = "http://www.nshen.net/blog/doc/flex/FileReference_download_test/FileReference_download_test.zip"; private var fileRef:FileReference; private var urlReq:URLRequest; private function init():void { // 初始化一个空ArrayCollection arrColl = new ArrayCollection(); // 以FILE_URL指定的地址建立一个URLRequest urlReq = new URLRequest(FILE_URL); // 定义一个FileReference对象,并填加一系列事件监听 fileRef = new FileReference(); fileRef.addEventListener(Event.CANCEL, doEvent); fileRef.addEventListener(Event.COMPLETE, doEvent); fileRef.addEventListener(Event.OPEN, doEvent); fileRef.addEventListener(Event.SELECT, doEvent); fileRef.addEventListener(HTTPStatusEvent.HTTP_STATUS, doEvent); fileRef.addEventListener(IOErrorEvent.IO_ERROR, doEvent); fileRef.addEventListener(ProgressEvent.PROGRESS, doEvent); fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, doEvent); } private function doEvent(evt:Event):void { // 取得当前FileReference的引用 var fr:FileReference = evt.currentTarget as FileReference; // 填加事件顺序和类型到DataGrid组件 arrColl.addItem({data:arrColl.length+1, type:evt.type, eventString:evt.toString()}); try { // 更新 Model. fileRefModel.creationDate = fr.creationDate; fileRefModel.creator = fr.creator; fileRefModel.modificationDate = fr.modificationDate; fileRefModel.name = fr.name; fileRefModel.size = fr.size; fileRefModel.type = fr.type; // 显示文本 txt.visible = true; } catch (err:*) { // uh oh, an error of sorts. } } private function downloadSourceCodeZip():void { // 清空现有的 array collection. arrColl = new ArrayCollection(); // 隐藏文本组件 txt.visible = false; // 开始下载 fileRef.download(urlReq); } private function showAlert(item:Object):void { Alert.show(item.eventString, item.type); } ]]> </mx:Script> <mx:Model id="fileRefModel"> <file> <creationDate>{""}</creationDate> <creator>{""}</creator> <modificationDate>{""}</modificationDate> <name>{""}</name> <size>{""}</size> <type>{""}</type> </file> </mx:Model> <mx:Button id="downloadBtn" label="Download example source code" icon="{diskIcon}" click="downloadSourceCodeZip()" toolTip="{FILE_URL}" height="40" /> <mx:DataGrid id="debug" dataProvider="{arrColl}" width="{downloadBtn.width}" rowCount="5" rowHeight="22" itemClick="showAlert(event.currentTarget.selectedItem)"> <mx:columns> <mx:DataGridColumn dataField="data" headerText="#" width="20" /> <mx:DataGridColumn dataField="type" headerText="Type" showDataTips="true" dataTipField="eventString" /> </mx:columns> </mx:DataGrid> <mx:Text id="txt" condenseWhite="true" visible="false"> <mx:text> creationDate: {fileRefModel.creationDate} creator: {fileRefModel.creator} modificationDate: {fileRefModel.modificationDate} name: {fileRefModel.name} size: {fileRefModel.size} type: {fileRefModel.type} </mx:text> </mx:Text> </mx:Application>
- FileReference_download_test.zip (2.3 KB)
- 下载次数: 6
发表评论
-
Flex, Flash性能优化官方文档
2013-05-07 15:25 779作为一个Flash开发人员,了解Flash性能优化是必修课。 ... -
Flex 图像裁剪、剪切
2013-02-07 14:56 737Flex 图像裁剪、剪切 -
Flex , Flash Swc文件与Swf文件的关系和使用
2013-02-07 13:49 847Flex , Flash Swc文件与Swf文件的关系和使用 -
Flex 错误处理,VerifyError: Error #1024: 发生堆栈下溢。
2013-02-05 14:12 1449VerifyError: Error #1024: 发生堆栈 ... -
Flex 编译参数选项
2013-02-05 13:52 832Mxmlc参数选项 描述 ... -
Flex Swf 访问本地文件,本地安全沙箱问题
2013-02-05 09:43 1264问题: 只有仅限于文件系统的 SWF 文件和可信的本地 S ... -
Flex 测试项目,图片压缩、上传、图片裁剪,Module测试,国际化
2013-02-02 15:38 995测试项目内容: 1. Module 加载测试 2. 样式 ... -
Flex 国际化
2013-02-02 15:30 1011内容示例:1001=alert info 和 1001 ... -
Flex 动态设置 Skin 、Style
2013-02-02 15:06 2529/** Flex3 的写法 */ StyleMan ... -
Flex 图片压缩、上传
2013-02-02 14:55 3610Flex 图片压缩 private functio ... -
Flex 加载资源、Skin 等文件,并动态生成对象
2013-02-02 14:28 1312private var symbolLoader:Load ... -
Flex 取当前URL 地址和参数
2012-06-19 10:29 1080方法一:在3.2下读不到,但4.0的SDK下是没有问题 ... -
Flex 学习电子书和资料
2012-04-26 15:47 1057Adobe Flex大师之路http://dl02.topsa ... -
Flex 学习电子书和资料
2012-04-26 08:16 0Flex大师之路 下载地址:http://club.tops ... -
Flex RemoteObject 处理多个方法和方法参数的使用
2012-04-25 17:09 1073<!-- 参数顺序必须与purchaseItem(S ... -
Flex AMF3 与 Java 数据类型对应表
2012-04-25 16:43 2565ActionScript type (AMF 3) ... -
Flex 与 Struts2 ByteArray 数据上传
2012-01-17 10:39 852Flex 与 Struts2 ByteArray 数据上传 ... -
Flex 安全沙箱问题 简单处理方法
2012-01-17 10:29 1285Flex安全沙箱问题 在你要访问的网站下面也要放一个c ... -
Flex4 Spark 组件 ComboBox 中文输入问题
2012-01-05 11:27 1952Flex4 Spark 组件 ComboBox 默认只能输入数 ... -
处理直接打开Flex 运行加载XML 安全问题
2011-12-22 10:32 1041处理直接打开Flex 运行加载XML 安全问题 1. ...
相关推荐
Flex与.NET互操作(五):使用FileReference+HttpHandler实现文件上传/下载 一文的源码的完整工程文件,包含FLEX客户端和 ASP.NET服务端源码! 在VS2010和FLash builder4 中运行!
Flex Builder 3 下载安装与项目创建详细说明 Flex中利用FileReference类下载文件的例子| 中文Flex例子
Flex与.NET互操作 使用FileReference+HttpHandler实现文件上传/下载
在项目开发过程中,经常会遇到文件上传下载的...但在flex中由于安全沙箱的原因flex程序不能直接访问本地文件,但是flex SDK中提供了FileReference和FileReferenceList两个类,可以通过这两个类来实现文件的上传下载。
FLEXd多文件上传,上传前MD5验证允许那些文件可以上传
//ItemDate单文件大小限制,-1表示不限制,默认值为30M param.TotalDate = (this.parameters.TotalDate == undefined || this.parameters.TotalDate == "") ? -1 : this.parameters.TotalDate;//TotalDate总...
完成的文件上传功能。使用FileReference类实现。还有多文件上传
请使用“flex 文件上传下载完整代码(修正版)”http://download.csdn.net/source/1815266
FileReferenceList 类或者FileReference 一个是多个上传一个是单个上传。用这2个类通过Java实现文件图片上传。
flex语言编写的,把xml内容存成xml文件保存到指定的位置!
在ActionScript中使用XML的示例:从Internet加载RSS数据 第章:使用本机JSON功能 JSONAPI概述 定义自定义JSON行为 第章:处理事件 事件处理基础知识 ActionScript事件处理与早期版本事件处理的不同之处 事件流 事件...
鉴于adobe并没有提供FileReference对浏览的文件的完整路径的接口。只能采用JS和fileinput控件来获取本地路径了。