スキップしてメイン コンテンツに移動

投稿

ラベル(Asynchronous)が付いた投稿を表示しています

ActionScript 3.0: Download Resource and Save as File Asynchronously

Here is a utility class for downloading resource and saving as file asynchronously . package utils.file { import flash.events.Event; import flash.events.EventDispatcher; import flash.events.ProgressEvent; import flash.filesystem.File; import flash.filesystem.FileStream; import flash.filesystem.FileMode; import flash.net.URLLoader; import flash.net.URLLoaderDataFormat; import flash.net.URLRequest; public class AsyncFileSaveDownloader extends EventDispatcher { public function AsyncFileSaveDownloader() { } public function download(url:String, path:String):void { var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.BINARY; loader.addEventListener(Event.COMPLETE, completeDownload); loader.load(new URLRequest(url)); function completeDownload(cevt:Event):void { l...