FileReference.download() not working

Posted by Lowgain on Stack Overflow See other posts from Stack Overflow or by Lowgain
Published on 2010-05-24T03:37:31Z Indexed on 2010/05/24 3:51 UTC
Read the original article Hit count: 320

I'm building a Flex app which requires me to download files.

I have the following code:

public function execute(event:CairngormEvent) : void
{
    var evt:StemDownloadEvent = event as StemDownloadEvent;
    var req:URLRequest = new URLRequest(evt.data.file_path);
    var localRef:FileReference = new FileReference();

    localRef.addEventListener(Event.OPEN, _open);
    localRef.addEventListener(ProgressEvent.PROGRESS, _progress);
    localRef.addEventListener(Event.COMPLETE, _complete);
    localRef.addEventListener(Event.CANCEL, _cancel);
    localRef.addEventListener(Event.SELECT, _select);
    localRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, _securityError);
    localRef.addEventListener(IOErrorEvent.IO_ERROR, _ioError);

    try {
        localRef.download(req);
    } catch (e:Error) {
        SoundRoom.logger.log(e);
    }
}

As you can see, I hooked up every possible event listener as well.

When this executes, I get the browse window, and am able to select a location, and click save. After that, nothing happens.

I have each event handler hooked up to my logger, and not a single one is being called! Is there something missing here?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript-3