ExternalInterface的给我使用多个参数时停止脚本的选项。为什么?给我、多个、脚本、选项

2023-09-09 21:28:26 作者:揽众星月

第一个版本:

ExternalInterface.call("$(document).trigger", "opened_file_chooser");

第二个版本:

Second version:

ExternalInterface.call("$(document).trigger('opened_file_chooser')");

如果我用的第一个版本,它的多,比第二慢得多。此外,浏览器模块,并在几秒钟后,火狐显示我的对话的脚本没有响应......并提供我停止它的可能性。如果我用的是第二版,调用Javascript是瞬间完成的。有没有一种方法,我可以做第一个工作以及第二?我认为这是更清洁(从一个code点)。

If I use the first version, it's much, much slower than the second. Also, the browser blocks, and after a few seconds Firefox shows me the dialog with "A script is not responding ... " and it offers me the possibility of stopping it. If I use the 2nd version, the call to Javascript is instantaneous. Is there a way I could make the first one work as well as the second? I think it's much cleaner ( from a code point of view ).

推荐答案

尝试设置超时,这将让ExternalInterface的回归到Flash这应有助于与阻塞:

Try setting a timeout which will let ExternalInterface "return" to Flash which should help with the blocking:

ExternalInterface.call("setTimeout","$(document).trigger('opened_file_chooser')","100");