如题:flex 中 要先弹出那个文件选择框,然后把filename 放到一个textinput中,再点击上传,怎么实现。
flex上传怎么做?
- 提问者网友:龅牙恐龙妹
- 2021-08-10 20:45
- 五星知识达人网友:拾荒鲤
- 2021-08-10 21:04
如:
<?xml version="1.0" encoding="utf-8"?>
<ns1:FTitleWindow xmlns:ns1="f8ssm.view.components.*"
xmlns:mx=" http://www.adobe.com/2006/mxml"
width="434" height="356" layout="absolute">
<mx:Label text="标题:" x="41" y="35" width="45"/>
<mx:TextInput x="106" y="33" width="256"/>
<mx:Label x="41" y="75" text="内容:"/>
<mx:TextArea x="106" y="74" width="256" height="159"/>
<mx:Button x="182" y="275" label="提 交" width="66"/>
<mx:Button x="288" y="275" label="取 消" click="this.close()"/>
<mx:Label x="41" y="245" text="附件:"/>
<mx:TextInput id="filename" x="106" y="243" width="220" height="24"/>
<mx:Button x="345" y="242" label="选择" width="52" click="fileUpload(event)"/>
<mx:Script>
<![CDATA[
import f8ssm.view.components.FileLoad;
import mx.controls.Alert;
private var fileload:FileLoad = new FileLoad();
private var file:FileReference;
private function fileUpload(e:MouseEvent):void{
var allTypes:Array=new Array();
allTypes.push(new FileFilter("*","*"));
file = new FileReference();
file.addEventListener(Event.SELECT, onSelect);
var boole:Boolean = file.browse(allTypes);
}
private function onSelect(e:Event):void{
this.filename.text = file.name.toString();
}
private function onClick():void{
//
//
}
]]>
</mx:Script>
</ns1:FTitleWindow>