Flex FileReference URLRequest 请求缓存问题
var variables:URLVariables = new URLVariables();variables.rannum = Math.random();var url:String = 文件地址var request:URLRequest = new URLRequest(encodeURL(uri));request.data = variables;request.method = URLRequestMethod.POST;
?
?
? ? 另附完整代码
? ??
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script><![CDATA[import mx.utils.UIDUtil; [Bindable] public var file:FileReference; private var currentAction:String; private var downloadURL:URLRequest; private function download():void{ var url:URLRequest=new URLRequest("http://localhost:8080/FlexMessageServer/test.txt"); url.method = URLRequestMethod.POST; url.data = UIDUtil.createUID(); file = new FileReference(); file.addEventListener(Event.COMPLETE,comple) file.download(url) } private function comple(e:Event):void { tex.text="已下载完成!" } ]]> </mx:Script> <mx:Button x="10" y="20" label="下载一个文件" click="download()"/> <mx:ProgressBar x="10" y="100" id="progress" source="{file}" label="已加载: %3%%"/> <mx:Text text="" x="10" y="145" id="tex"/></mx:Application>
?