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

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

    This is a comment on Thomas' answer (I don't have enough XP to comment yet): The mousedown and mouseup workaround works nicely. Just a note that if you make any changes in prepare_PDF() that need 'undoing' in save_PDF(), then its a good idea to call that code on the mouseout event as well, since there might be a case that the user mousedown's on the button, but then moves the mouse away from the button.

    This was particularly relevant for my case, in which we increase the size of a watermark on an image when the user clicks the download button (that triggers the .save() call). I reduce the size of the watermark down to normal on the mousedown and mouseout events.

提交回复
热议问题