I'm trying to use fileReference to allow users to download images, but
it keeps failing, without errors, and without even seeming to start
the download. What makes it weird is that it does open the finder
window and prompts me to save the select a download location etc, but
then when I click save...nothing. No errors, no files, just nothing.
Here is the code I'm currently using (with puppy photo substituted for
actual content). This is failing both locally and when uploaded to the
server. Any suggestions much appreciated, I've been googling but
havent found a solution.

tia,

Matt


//CODE


private function deskClickHandler(e:MouseEvent):void{

        var downloadURL:URLRequest;
       var fileName:String = "SomeFile.pdf";
        var file:FileReference;

        downloadURL = new URLRequest();
        downloadURL.url =
"http://mystuffspace.com/graphic/adorable-puppies.jpg";;
        file = new FileReference();
        file.addEventListener(ProgressEvent.PROGRESS, progressHandler);
        file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        file.addEventListener(Event.COMPLETE, completeHandler);
        file.download(downloadURL, fileName);
}

private function progressHandler(event:ProgressEvent):void {
    var file:FileReference = FileReference(event.target);
    trace("progressHandler: name=" + file.name + " bytesLoaded=" +
event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
}

private function ioErrorHandler(event:IOErrorEvent):void {
    trace("ioErrorHandler: " + event);
}

private function completeHandler(event:Event):void {
    trace("completeHandler: " + event);
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to