Flex FileReference 为什么只能定义在方法外才会执行
private var DownLoadFile:FileReference;
private function downLoad():void
{
var fileLocation:String = "http://localhost:8080/disk/FileDownPO"+"?filename="+encodeFileName+"&fileLoad="+encodeFilePath;
var downLoadURL:URLRequest = new URLRequest(fileLocation);
DownLoadFile = new FileReference(); //这样可执行成功
DownLoadFile.addEventListener(Event.COMPLETE,completeHandler);
DownLoadFile.download(downLoadURL,fname);
} 可执行 跳转
若:
private function downLoad():void
{
var DownLoadFile:FileReference = new FileReference(); //进行这样定义则不执行!!
DownLoadFile.addEventListener(Event.COMPLETE,completeHandler);
DownLoadFile.download(downLoadURL,fname);
}
求解!
[解决办法]
应该可以吧。没试过。做地图编辑器的时候用过
[解决办法]
可以定义在方法内部的。我基本都是定义在内部的。