首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

Flex FileReference 为什么只能定义在方法外才会执行解决方法

2012-03-11 
Flex FileReference 为什么只能定义在方法外才会执行private var DownLoadFile:FileReferenceprivate fun

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);

}

求解!

[解决办法]
应该可以吧。没试过。做地图编辑器的时候用过
[解决办法]
可以定义在方法内部的。我基本都是定义在内部的。

热点排行