我的网站需要一个actionscript 3功能,让人们在点击按钮后下载文档.
无法在网上找到这个.
谢谢!詹妮弗
一个FileReference ::下载()
btn.addEventListener(MouseEvent.CLICK, promptDownload); private function promptDownload(e:MouseEvent):void { req = new URLRequest("http://example.com/remotefile.doc"); file = new FileReference(); file.addEventListener(Event.COMPLETE, completeHandler); file.addEventListener(Event.CANCEL, cancelHandler); file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); file.download(req, "DefaultFileName.doc"); } private function cancelHandler(event:Event):void { trace("user canceled the download"); } private function completeHandler(event:Event):void { trace("download complete"); } private function ioErrorHandler(event:IOErrorEvent):void { trace("ioError occurred"); }