function downloadToDesktop(filename):void {
var path:String = catalogPath + filename;
var request:URLRequest = new URLRequest(path);
var localRef:FileReference = new FileReference();
localRef.addEventListener(Event.COMPLETE, downloadComplete);
localRef.addEventListener(IOErrorEvent.IO_ERROR, downloadIOError);
localRef.download(request);
}
function downloadComplete(e:Event):void
{
trace("Download complete. User downloaded:", FileReference(e.currentTarget).name)
}
function downloadIOError(e:IOErrorEvent):void
{
trace("Download error:", e.text, "\nCannot download:", FileReference(e.currentTarget).name);
}
|