碰到奇怪的问题:
private function downloadFile():void {
// var pdfUrl = "broker/pdf.report?method=exportGECReport&format=pdf"
var url:String = "broker/pdf.report?method=exportPdfReport&format=pdf";
var downloadURL:URLRequest = new URLRequest(url);
var downLoadfile:FileReference = new FileReference();
downLoadfile.addEventListener(Event.COMPLETE, downloadCompleteHandler);
downLoadfile.download(downloadURL);
}
无法download.
原因是FileReference 定义在方法内,被垃圾回收掉了,所以要把fileReference定义在不容易被回收掉的地方,如在方法外面