- 浏览: 99632 次
- 性别:
- 来自: 大连
文章分类
最新评论
什么都别说附上代码
UploadFile.java
package com.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.springframework.web.context.support.HttpRequestHandlerServlet;
import sun.misc.Request;
public class UploadFile {
public void uploadFile(byte[] content, String fileName) throws Exception {
String filePath=getClass().getClassLoader().getResource("/").getFile();
filePath=filePath.substring(0, (filePath.lastIndexOf("WEB-INF/classes/")));
File file = new File(filePath+"file\\");
if(!file.exists()) file.mkdirs(); //如果目录不存在就新建
File filePro=new File(filePath+"file\\"+ fileName);
FileOutputStream stream = new FileOutputStream(filePro);
if (content != null){
stream.write(content);
stream.close();
}
}
}
flex应用组件
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
FileUploader.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
title="上传文件"
width="609" height="400"
dropShadowVisible="true"
creationComplete="init();"
close="titlewindow1_closeHandler(event)"
backgroundColor="#C6C6C6"
xmlns:timerLoader="com.thams.efile.timerLoader.*">
<s:layout>
<s:VerticalLayout horizontalAlign="center" paddingTop="10"/>
</s:layout>
<fx:Script>
<![CDATA[
import com.thams.efile.vo.FileRefrenceVo;
import com.thams.utils.ArrayCollectionUtils;
import com.thams.utils.MenuImageClass;
import flash.utils.getTimer;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.ProgressBar;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
private var fileList:FileReferenceList = new FileReferenceList(); //多选文件的list
[Bindable]
private var selectedFiles: ArrayCollection = new ArrayCollection(); //多选的文件分离成文件数组
private var fileRef:FileReference;
public var ip:String;
public var port:String;
public var user:String;
public var pass:String;
/**
* 初始化
*/
public function init():void{
fileList.addEventListener(Event.SELECT,fileSelectHandler);
}
/**
*监听文件选择的处理函数
*/
public var URL:String;
private function fileSelectHandler(event: Event): void
{
var filesNames:String = "";
if(fileList.fileList.length>10){
Alert.show("一次最多只能上传10个文件");
}else{
for(var i:int=0;i<fileList.fileList.length;i++){
var f:FileReference = FileReference(fileList.fileList[i]);
if(f.size/(1024*1024)>100){
//Alert.show(f.name+" 文件不能超过100M!已经移除!");
filesNames += f.name+" \n";
continue;
}
var file:FileRefrenceVo= new FileRefrenceVo();
file.fileName = f.name;
file.fileSize = f.size/1024;
file.fileType = f.type;
file.fileRefrence = f;
var b:Boolean = false;
for each(var o:FileRefrenceVo in selectedFiles){
if(o.fileName == file.fileName){
b = true;
}
}
if(!b){
selectedFiles.addItem(file);
browseFile.enabled = false;
upFile.enabled = true;
// saveFile.enabled = false;
}
}
if(filesNames){
Alert.show(filesNames,"以下文件单个超过100M,已经移除!");
}
// if( fileListSize/(1024*1024)>100 ){
// selectedFiles.removeAll();
// fileListSize = 0;
// Alert.show("文件总大小应小于100M");
// }
}
}
/**
* 点击"浏览"按钮-->选择文件
*/
private function selectFile():void
{
//浏览文件,因为是FileReferenceList所以可以多选. 并用FileFilter过滤文件类型.
fileList.browse([new FileFilter("所有文件 (*.*)","*.*")]);
}
/**
* 上传一个文件,监听文件上传完成事件,递归调用.
*/
private function doSingleUploadFile():void{
upFile.enabled = false;
if(selectedFiles.length>10){
var b:Boolean = true;
while(b){
if(fileList&&fileList.fileList.length>0){
var fi:FileReference = fileList.fileList.shift();
for each(var selfi:FileRefrenceVo in selectedFiles){
if(fi.name == selfi.fileName){
ArrayCollectionUtils.removeObjFromArrayCollection(selectedFiles,selfi);
}
}
}else{
b = false;
}
}
Alert.show("一次最多只能上传10个文件","提示");
browseFile.enabled = true;
}else{
if (fileList.fileList&&fileList.fileList.length > 0){
var f: FileReference = fileList.fileList.shift() as FileReference;
f.addEventListener(Event.COMPLETE, doSingleUploadFileComplete);
f.load();
}else{
// saveFile.enabled = true;
browseFile.enabled = true;
}
}
}
// else if( fileListSize/(1024*1024)>100 ){
// selectedFiles.removeAll();
// fileListSize = 0;
// Alert.show("文件总大小应小于100M");
// }
/**
* 一个文件上传完成事件的处理函数,递归执行上传下一个文件.
*/
private function doSingleUploadFileComplete(event: Event):void{
var file: FileReference = event.target as FileReference;
var filename:String="";
file.removeEventListener(Event.COMPLETE, doSingleUploadFileComplete);
var date:Date = new Date();
filename=date.getFullYear()+date.getMonth()+date.getDate()+date.getMinutes()+date.getSeconds()+((Math.random()*10).toString()).substring(0,1)+((Math.random()*10).toString()).substring(0,1)+((Math.random()*10).toString()).substring(0,1)+file.type;
upload.uploadFile(file.data,filename);//开始上传
doSingleUploadFile();
}
public function removeFile(f: FileReference): void
{
var index: int = selectedFiles.getItemIndex(f);
if (index != -1)
selectedFiles.removeItemAt(index);
}
protected function PopRemoveUpload(event:CloseEvent):void
{
}
protected function titlewindow1_closeHandler(event:CloseEvent):void
{
PopUpManager.removePopUp(this);
}
]]>
</fx:Script>
<fx:Declarations>
<s:RemoteObject id="upload" destination="uploadFile" endpoint="http://192.168.1.103:8080/Lx/messagebroker/amf"/>
</fx:Declarations>
<mx:DataGrid id="dg" width="587" height="291"
dataProvider="{selectedFiles}">
<mx:columns>
<mx:DataGridColumn headerText="文件名" dataField="fileName" width="150" sortable="false"/>
<mx:DataGridColumn headerText="大小(kb)" dataField="fileSize" width="100" sortable="false"/>
<mx:DataGridColumn headerText="类型" dataField="fileType" width="70" sortable="false"/>
<mx:DataGridColumn headerText="上传状态" dataField="" width="230" sortable="false">
<mx:itemRenderer>
<fx:Component>
<mx:HBox width="130" paddingLeft="2" horizontalGap="2">
<fx:Script>
<![CDATA[
override public function set data(value:Object):void{
super.data = value;
data.fileRefrence.addEventListener(ProgressEvent.PROGRESS,progressHandler);
data.fileRefrence.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,fini);
}
private function progressHandler(event:ProgressEvent):void{
var procent:uint=event.bytesLoaded/event.bytesTotal*100;
}
public function fini(event: DataEvent):void{
progress.visible=true;
progress.label="完成";
data.fileRefrence.removeEventListener(DataEvent.UPLOAD_COMPLETE_DATA,fini);
}
]]>
</fx:Script>
<mx:ProgressBar id="progress" width="80%"
minimum="0" maximum="100" source="{data.fileRefrence}"
labelPlacement="center" enabled="true" >
</mx:ProgressBar>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<s:controlBarContent>
<s:HGroup horizontalAlign="right" clipAndEnableScrolling="true" paddingBottom="0" paddingTop="0" paddingLeft="10" paddingRight="10" width="100%">
<s:Button id="browseFile" label="选择本地文件" toolTip="选择本地文件" click="selectFile()"/>
<s:Button id="upFile" label="上传" toolTip="上传" click="doSingleUploadFile();" enabled="false"/>
<s:Button id="out" label="退出" toolTip="退出" width="59" />
</s:HGroup>
</s:controlBarContent>
</s:TitleWindow>
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
FileRefrenceVo.as
package com.thams.efile.vo
{
import flash.net.FileReference;
[Bindable]
public class FileRefrenceVo
{
public var fileName:String;
public var fileSize:int;
public var fileType:String;
public var fileRefrence:FileReference;
}
}
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
MenuImageClass.as
package com.thams.utils
{
public class MenuImageClass
{
[bindable]
public static var tuichu:Class;
[bindable]
public static var shangyi:Class;
[bindable]
public static var baocun:Class;
[bindable]
public static var file:Class;
public function MenuImageClass()
{
}
}
}
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
ArrayCollectionUtils.as
package com.thams.utils
{
import mx.collections.ArrayCollection;
public class ArrayCollectionUtils
{
public function ArrayCollectionUtils()
{
}
public static function removeObjFromArrayCollection(coll:ArrayCollection,obj:Object):ArrayCollection{
var len:uint = coll.length;
for(var i:Number = len-1; i > -1; i--)
{
if(coll.getItemAt(i) == obj)
{
coll.removeItemAt(i);
}
}
return coll;
}
}
}
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
downloadFile.mxml
<?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="init();"
xmlns:fileDow="com.thams.*">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
-------------------------------------------------------------------------------------文件下载--
<fx:Script>
<![CDATA[
import com.thams.downloadFile;
import com.thams.efile.uploader.FileUploader;
import mx.managers.PopUpManager;
public function init():void{
var win:FileUploader = new FileUploader();
PopUpManager.addPopUp(win, this, true);
PopUpManager.centerPopUp(win);
}
]]>
</fx:Script>
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.net.FileFilter;
private var downloadURL:URLRequest;
private var file:FileReference;
public function FileReference_download(downloadurl:String,fileNames:Stirng):void{
downloadURL = new URLRequest();
downloadURL.url = downloadurl;
file = new FileReference();
configureListeners(file);
file.download(downloadURL, fileNames);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.CANCEL, cancelHandler);
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(Event.SELECT, selectHandler);
}
private function cancelHandler(event:Event):void {
trace("cancelHandler: " + event);
}
private function completeHandler(event:Event):void {
trace("completeHandler: " + event);
}
private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
}
private function openHandler(event:Event):void {
trace("openHandler: " + event);
}
private function progressHandler(event:ProgressEvent):void {
var file:FileReference = FileReference(event.target);
trace("progressHandler name=" + file.name + " bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
private function selectHandler(event:Event):void {
var file:FileReference = FileReference(event.target);
trace("selectHandler: name=" + file.name + " URL=" + downloadURL.url);
}
]]>
</fx:Script>
<s:Button x="300" y="50" label="远程文件下载"
click="FileReference_download('http://192.168.1.103:8080/项目名/保存的文件夹/要下载的文件',你的要下载的文件名称);"/>
</s:WindowedApplication>
UploadFile.java
package com.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.springframework.web.context.support.HttpRequestHandlerServlet;
import sun.misc.Request;
public class UploadFile {
public void uploadFile(byte[] content, String fileName) throws Exception {
String filePath=getClass().getClassLoader().getResource("/").getFile();
filePath=filePath.substring(0, (filePath.lastIndexOf("WEB-INF/classes/")));
File file = new File(filePath+"file\\");
if(!file.exists()) file.mkdirs(); //如果目录不存在就新建
File filePro=new File(filePath+"file\\"+ fileName);
FileOutputStream stream = new FileOutputStream(filePro);
if (content != null){
stream.write(content);
stream.close();
}
}
}
flex应用组件
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
FileUploader.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
title="上传文件"
width="609" height="400"
dropShadowVisible="true"
creationComplete="init();"
close="titlewindow1_closeHandler(event)"
backgroundColor="#C6C6C6"
xmlns:timerLoader="com.thams.efile.timerLoader.*">
<s:layout>
<s:VerticalLayout horizontalAlign="center" paddingTop="10"/>
</s:layout>
<fx:Script>
<![CDATA[
import com.thams.efile.vo.FileRefrenceVo;
import com.thams.utils.ArrayCollectionUtils;
import com.thams.utils.MenuImageClass;
import flash.utils.getTimer;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.ProgressBar;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
private var fileList:FileReferenceList = new FileReferenceList(); //多选文件的list
[Bindable]
private var selectedFiles: ArrayCollection = new ArrayCollection(); //多选的文件分离成文件数组
private var fileRef:FileReference;
public var ip:String;
public var port:String;
public var user:String;
public var pass:String;
/**
* 初始化
*/
public function init():void{
fileList.addEventListener(Event.SELECT,fileSelectHandler);
}
/**
*监听文件选择的处理函数
*/
public var URL:String;
private function fileSelectHandler(event: Event): void
{
var filesNames:String = "";
if(fileList.fileList.length>10){
Alert.show("一次最多只能上传10个文件");
}else{
for(var i:int=0;i<fileList.fileList.length;i++){
var f:FileReference = FileReference(fileList.fileList[i]);
if(f.size/(1024*1024)>100){
//Alert.show(f.name+" 文件不能超过100M!已经移除!");
filesNames += f.name+" \n";
continue;
}
var file:FileRefrenceVo= new FileRefrenceVo();
file.fileName = f.name;
file.fileSize = f.size/1024;
file.fileType = f.type;
file.fileRefrence = f;
var b:Boolean = false;
for each(var o:FileRefrenceVo in selectedFiles){
if(o.fileName == file.fileName){
b = true;
}
}
if(!b){
selectedFiles.addItem(file);
browseFile.enabled = false;
upFile.enabled = true;
// saveFile.enabled = false;
}
}
if(filesNames){
Alert.show(filesNames,"以下文件单个超过100M,已经移除!");
}
// if( fileListSize/(1024*1024)>100 ){
// selectedFiles.removeAll();
// fileListSize = 0;
// Alert.show("文件总大小应小于100M");
// }
}
}
/**
* 点击"浏览"按钮-->选择文件
*/
private function selectFile():void
{
//浏览文件,因为是FileReferenceList所以可以多选. 并用FileFilter过滤文件类型.
fileList.browse([new FileFilter("所有文件 (*.*)","*.*")]);
}
/**
* 上传一个文件,监听文件上传完成事件,递归调用.
*/
private function doSingleUploadFile():void{
upFile.enabled = false;
if(selectedFiles.length>10){
var b:Boolean = true;
while(b){
if(fileList&&fileList.fileList.length>0){
var fi:FileReference = fileList.fileList.shift();
for each(var selfi:FileRefrenceVo in selectedFiles){
if(fi.name == selfi.fileName){
ArrayCollectionUtils.removeObjFromArrayCollection(selectedFiles,selfi);
}
}
}else{
b = false;
}
}
Alert.show("一次最多只能上传10个文件","提示");
browseFile.enabled = true;
}else{
if (fileList.fileList&&fileList.fileList.length > 0){
var f: FileReference = fileList.fileList.shift() as FileReference;
f.addEventListener(Event.COMPLETE, doSingleUploadFileComplete);
f.load();
}else{
// saveFile.enabled = true;
browseFile.enabled = true;
}
}
}
// else if( fileListSize/(1024*1024)>100 ){
// selectedFiles.removeAll();
// fileListSize = 0;
// Alert.show("文件总大小应小于100M");
// }
/**
* 一个文件上传完成事件的处理函数,递归执行上传下一个文件.
*/
private function doSingleUploadFileComplete(event: Event):void{
var file: FileReference = event.target as FileReference;
var filename:String="";
file.removeEventListener(Event.COMPLETE, doSingleUploadFileComplete);
var date:Date = new Date();
filename=date.getFullYear()+date.getMonth()+date.getDate()+date.getMinutes()+date.getSeconds()+((Math.random()*10).toString()).substring(0,1)+((Math.random()*10).toString()).substring(0,1)+((Math.random()*10).toString()).substring(0,1)+file.type;
upload.uploadFile(file.data,filename);//开始上传
doSingleUploadFile();
}
public function removeFile(f: FileReference): void
{
var index: int = selectedFiles.getItemIndex(f);
if (index != -1)
selectedFiles.removeItemAt(index);
}
protected function PopRemoveUpload(event:CloseEvent):void
{
}
protected function titlewindow1_closeHandler(event:CloseEvent):void
{
PopUpManager.removePopUp(this);
}
]]>
</fx:Script>
<fx:Declarations>
<s:RemoteObject id="upload" destination="uploadFile" endpoint="http://192.168.1.103:8080/Lx/messagebroker/amf"/>
</fx:Declarations>
<mx:DataGrid id="dg" width="587" height="291"
dataProvider="{selectedFiles}">
<mx:columns>
<mx:DataGridColumn headerText="文件名" dataField="fileName" width="150" sortable="false"/>
<mx:DataGridColumn headerText="大小(kb)" dataField="fileSize" width="100" sortable="false"/>
<mx:DataGridColumn headerText="类型" dataField="fileType" width="70" sortable="false"/>
<mx:DataGridColumn headerText="上传状态" dataField="" width="230" sortable="false">
<mx:itemRenderer>
<fx:Component>
<mx:HBox width="130" paddingLeft="2" horizontalGap="2">
<fx:Script>
<![CDATA[
override public function set data(value:Object):void{
super.data = value;
data.fileRefrence.addEventListener(ProgressEvent.PROGRESS,progressHandler);
data.fileRefrence.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,fini);
}
private function progressHandler(event:ProgressEvent):void{
var procent:uint=event.bytesLoaded/event.bytesTotal*100;
}
public function fini(event: DataEvent):void{
progress.visible=true;
progress.label="完成";
data.fileRefrence.removeEventListener(DataEvent.UPLOAD_COMPLETE_DATA,fini);
}
]]>
</fx:Script>
<mx:ProgressBar id="progress" width="80%"
minimum="0" maximum="100" source="{data.fileRefrence}"
labelPlacement="center" enabled="true" >
</mx:ProgressBar>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<s:controlBarContent>
<s:HGroup horizontalAlign="right" clipAndEnableScrolling="true" paddingBottom="0" paddingTop="0" paddingLeft="10" paddingRight="10" width="100%">
<s:Button id="browseFile" label="选择本地文件" toolTip="选择本地文件" click="selectFile()"/>
<s:Button id="upFile" label="上传" toolTip="上传" click="doSingleUploadFile();" enabled="false"/>
<s:Button id="out" label="退出" toolTip="退出" width="59" />
</s:HGroup>
</s:controlBarContent>
</s:TitleWindow>
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
FileRefrenceVo.as
package com.thams.efile.vo
{
import flash.net.FileReference;
[Bindable]
public class FileRefrenceVo
{
public var fileName:String;
public var fileSize:int;
public var fileType:String;
public var fileRefrence:FileReference;
}
}
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
MenuImageClass.as
package com.thams.utils
{
public class MenuImageClass
{
[bindable]
public static var tuichu:Class;
[bindable]
public static var shangyi:Class;
[bindable]
public static var baocun:Class;
[bindable]
public static var file:Class;
public function MenuImageClass()
{
}
}
}
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
ArrayCollectionUtils.as
package com.thams.utils
{
import mx.collections.ArrayCollection;
public class ArrayCollectionUtils
{
public function ArrayCollectionUtils()
{
}
public static function removeObjFromArrayCollection(coll:ArrayCollection,obj:Object):ArrayCollection{
var len:uint = coll.length;
for(var i:Number = len-1; i > -1; i--)
{
if(coll.getItemAt(i) == obj)
{
coll.removeItemAt(i);
}
}
return coll;
}
}
}
分开----------------------------------------------------------------------------------------------------------------------------------------------------------------
downloadFile.mxml
<?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="init();"
xmlns:fileDow="com.thams.*">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
-------------------------------------------------------------------------------------文件下载--
<fx:Script>
<![CDATA[
import com.thams.downloadFile;
import com.thams.efile.uploader.FileUploader;
import mx.managers.PopUpManager;
public function init():void{
var win:FileUploader = new FileUploader();
PopUpManager.addPopUp(win, this, true);
PopUpManager.centerPopUp(win);
}
]]>
</fx:Script>
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.net.FileFilter;
private var downloadURL:URLRequest;
private var file:FileReference;
public function FileReference_download(downloadurl:String,fileNames:Stirng):void{
downloadURL = new URLRequest();
downloadURL.url = downloadurl;
file = new FileReference();
configureListeners(file);
file.download(downloadURL, fileNames);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.CANCEL, cancelHandler);
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(Event.SELECT, selectHandler);
}
private function cancelHandler(event:Event):void {
trace("cancelHandler: " + event);
}
private function completeHandler(event:Event):void {
trace("completeHandler: " + event);
}
private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
}
private function openHandler(event:Event):void {
trace("openHandler: " + event);
}
private function progressHandler(event:ProgressEvent):void {
var file:FileReference = FileReference(event.target);
trace("progressHandler name=" + file.name + " bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
private function selectHandler(event:Event):void {
var file:FileReference = FileReference(event.target);
trace("selectHandler: name=" + file.name + " URL=" + downloadURL.url);
}
]]>
</fx:Script>
<s:Button x="300" y="50" label="远程文件下载"
click="FileReference_download('http://192.168.1.103:8080/项目名/保存的文件夹/要下载的文件',你的要下载的文件名称);"/>
</s:WindowedApplication>
发表评论
-
Adobe Flash Builder 4.6破解方法
2012-12-16 20:08 7C:\Program Files (x86)\Adobe\Ad ... -
FluorineFx 配置支持纯AS3工程!
2012-11-30 13:45 0FluorineFx 配置支持纯AS3工程! 由于自己用的纯 ... -
Flex中ArrayCollection的复制
2012-11-30 13:39 0lex中ArrayCollection的复制 2011- ... -
Flex的array和arrayCollection的应用实例
2012-11-30 13:34 0ArrayCollection是flex中的数组集合类,它是很 ... -
Flex air 中调用com组件的方法
2012-11-30 11:45 0air中直接调用com组件是很难做到的,但我们可以通过Fl ... -
FluorineFx 之 DateFeed,既服务端的数据推送服务
2012-11-30 11:29 0在开发如股票客户端的软件,客户端的数据在实时刷新,是由于服务端 ... -
收藏 flex+fluorinefx+asp.net c#后台如何接收arraycollection 并转换处理
2012-11-30 11:25 0flex,在.NET环境下通过FluorineFx传送Arra ... -
特殊符号收集大全
2012-11-27 19:06 875愛心符號 愛心符號怎 ... -
TextFormat设置中文字体font属性注意的问题
2012-11-27 19:05 2371如果要设置的字体为中文名称,则一定要使用对应的英文名称来设置才 ... -
flex国际化的问题
2012-11-27 18:52 7001、如果是简单项目,一般采用的是类似struts的bundle ... -
flex textfield中文字体
2012-11-27 17:14 924由于flex的图文混排总是有问题,而且效率实在有点低。所以最近 ... -
FLEX如何设置发光字体
2012-11-27 16:35 678<mx:Text id="bulletin&q ... -
Flex实现全屏源代码示例
2012-11-12 10:18 581stage.displayState = (stage.dis ... -
flex4.5组件:如何自定义VideoPlayer的全屏行为
2012-11-12 09:41 850Flex4中增加了一个视频播放组件:VideoPlayer,相 ... -
FluorineFX初学者之最初配置 Flex4与.NET结合 .
2012-11-09 09:43 864FluorineFX整个架构和BlazeDs差不多,只是最开始 ... -
Flex 绑定/双向绑定
2012-11-08 11:39 6451.什么是数据绑定? Data binding is ... -
Flex ArrayCollection 之排序
2012-11-07 15:59 651利用ArrayCollection的sort属性 & ... -
Flex读取xml文件
2012-11-07 13:12 552<?xml version="1.0& ... -
FLEX中使用FLVPlayback控件
2012-11-07 08:58 785即swc文件的导入,使用问题. FLVPlaybackAS ... -
VideoPlayer
2012-11-06 15:59 1981/** * VERSION: 1.0 * DATE: 20 ...
相关推荐
Flex+Java、PHP 批量上传实例文档Flex+Java、PHP 批量上传实例文档Flex+Java、PHP 批量上传实例文档Flex+Java、PHP 批量上传实例文档Flex+Java、PHP 批量上传实例文档Flex+Java、PHP 批量上传实例文档Flex+Java、...
Flex+Java 文件上传
Flex+Java Servlet处理文件上传 关于上传文件
本软件主要是flex+java进行文件上传操作。你只要安装有flash player 9.0就可以运行。给予adobe公司的flex builder3.0开发。如要下载运行请看详细说明。谢谢
flex 数据库操作 romotingobject 连接java后台文件 与数据库进行交互
项目的一部分源码flex+java,项目的一部分源码flex+java,项目的一部分源码flex+java,
Flex+Java完美整合框架,cleartookit使用Balaze框架
一个flex+java的登录实例完整版+flex框架 一个flex+java的登录实例完整版+flex框架
flex+java+spring+hibernate+blazeds整合
Flex+Java+lcds 项目源码及配置文档, tomcat 部署即可运行。
flex ,java, spring 如何集成为一个工程的开发步骤,有截图。给需要的朋友。
flex+java的档案管理系统,具体说明去下载文件
Flex+JAVA+BlazeDS开发环境配置(Java工程和Flex工程独立).doc
Flex + blazeds + Java推送Demo 本例实现由Flex一端客户端发送消息, 然后由Java端在发布到所有订阅的其它Flex端. 里面有说明与源码, 还有一个直接放到Tomcat里面的直接发布的项目 小编使用工具 eclipse3.5 flex sdk...
Flex4.6+java+servlet上传图片例子+图片上传预览
设置服务端IP和端口 <br>----------------------------- chat 客户端代码 FLEX3 开发 ChatServer Delphi6 开发的服务端 Server java 开发的服务端 WindowsApplication1 C# 开发的服务端 <br>...
flex+java的留言板,具体请看文档
Flex+Java Servlet文件上传实例
Flex+Java Servlet处理文件上传
hibernate+flex+spring 整合,hibernate+flex+spring 集成