Flex's FileReference.save() can only be called in a user event handler — how can I get around this?

后端 未结 6 1505
孤独总比滥情好
孤独总比滥情好 2020-12-03 08:11

I need to call FileReference.save() after a web service call has completed, but this method has a restriction: \"In Flash Player, you can only call this method successfully

6条回答
  •  星月不相逢
    2020-12-03 08:46

    As a workaround I used the ExternalInterface class. I created a javascript function with this code

    function downloadFile (url) {
                window.open(url);
            }
    

    An in AS3 I call

    var url = 'www.example.com/downloadfile.php?file_id=xxx';
    ExternalInterface.call('downloadAttachmentFile', url);
    

    So with that I transfer the file handling to JS/HTML.

提交回复
热议问题