flexÎļþÏÂÔØ
1flex¶Ë
<mx:Button label="ÏÂ ÔØ" click="download()"/>
//ÏÂÔØ
public function download():void{
var str:String=this.uploadfiles.selectedIndex.toString();
if(str=="-1"){
Alert.show("ÇëÑ¡ÖÐÒªÏÂÔصÄÎļþ");
}else{
downloadfiles();
}
}
public function downloadfiles():void{
var loadid:String=this.uploadfiles.selectedItem.loadid;
if(loadid==null || loadid==""){
Alert.show("¶Ô²»Æ𣬸ÃÎļþ»¹Î´ÉÏ´«");
}
var urlAddress:String=model.root+"/uploadFiles.do?method=download&loadid="+loadid;
//URLRequest¿ÉÒÔ²¶»ñµ¥¸öHTTPµÄËùÓÐÐÅÏ¢
var url:URLRequest=new URLRequest(urlAddress);
var loadname:String=this.uploadfiles.selectedItem.loadname;
//download()·½·¨ÌáʾÓû§ÌṩÎļþµÄ±£´æλÖò¢¿ªÊ¼´ÓÔ¶³Ì URL ½øÐÐÏÂÔØ¡£
filedown.download(url,loadname);
}
protected override function createChildren():void{
super.createChildren();
filedown.addEventListener(Event.COMPLETE,onDownCompleted);
}
public function onDownCompleted(evt:Event):void{
this.resultlabel.visible=true;
var fileref:FileReference = evt.currentTarget as FileReference;
resultlabel.text = "ÎļþÃû:" + uploadfiles.selectedItem.loadname+ "ÏÂÔØÍê±Ï£¡";
}
javaºǫ́(action)
/**
* ÎļþÏÂÔØ
*
* @param mapping
&nb
Ïà¹ØÎĵµ£º
FlexÀ¬»ø»ØÊÕºÍÐÔÄÜÓÅ»¯
2009-10-10 10:08
FlexÀ¬»ø»ØÊÕµÄһЩ֪ʶ×ܽ᣺
1¡¢±»É¾³ý¶ÔÏóÔÚÍⲿµÄËùÓÐÒýÓÃÒ»¶¨Òª±»É¾³ý¸É¾»²ÅÄܱ»ÏµÍ³µ±³ÉÀ¬»ø»ØÊÕ´¦Àíµô¡£
2¡¢¸¸¶ÔÏóÄÚ²¿µÄ×Ó¶ÔÏó±»ÍⲿÆäËû¶ÔÏóÒýÓÃÁË£¬»áµ¼Ö´Ë×Ó¶ÔÏ󲻻ᱻɾ³ý£¬×Ó¶ÔÏ󲻻ᱻɾ³ýÓֻᵼÖÂÁ˸¸¶ÔÏ󲻻ᱻɾ³ý¡£
3¡¢Èç¹ûÒ»¸ö¶ÔÏóÖÐÒýÓÃÁËÍⲿ¶ÔÏ󣬵±× ......
1¡¢mian.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="HTTPSrv.send();" width="242" height="442">
<mx:Script>
<!--[CDATA[
import mx.rpc.events.ResultEv ......
±¾ÎÄϵԴ´£¬²Î¿¼ÁËFlexµÄ¹Ù·½Îĵµ£¡
ÔÚ´¦ÀíÎı¾Ê±£¬ÎªÁËÃÀ¹Û£¬ÓÐʱ»á¸øÎı¾Ñ¡ÔñһЩÌØÊâµÄ×ÖÌ壬ʹµÃÎı¾²»ÄÇôµ¥µ÷£¬Õâ¾Í»áÒý·¢Ò»¸öÎÊÌ⣺ÓÉÓÚÿ¸öÓû§µÄϵͳÓвîÒ죬µ±¶Ô·½»úÆ÷ÉÏûÓа²×°ÄãÖ¸¶¨µÄ×ÖÌåʱ£¬Flash Player»á×Ô¶¯Ñ¡ÔñÒ»¸öºÏÊʵÄ×ÖÌ壬ÎÞ·¨±£Ö¤ÎÄ×ÖµÄÍâ¹ÛÔ ......