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

后端 未结 6 1498
孤独总比滥情好
孤独总比滥情好 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 09:02

    What i do to solve this is to show an alert message with an anonymous function so i don't have to create a button.

    Alert.show("Do you wish to download the file?", "Confirm", Alert.OK | Alert.CANCEL, this, function (eventObj:CloseEvent):void {
                                                                                                        if (eventObj.detail == Alert.OK) {
                                                                                                            fileReference.save(zipOut.byteArray, dateFormater_titulo.format(new Date ()) + ".zip");
                                                                                                        }//if
                                                                                                     }/*function*/, null, Alert.OK);
    

提交回复
热议问题