ExternalInterface gives me an option of stopping the script when using multiple parameters. Why?

自闭症网瘾萝莉.ら 提交于 2019-12-14 01:47:05

问题


First version:

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

Second version:

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

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 ).


回答1:


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");


来源:https://stackoverflow.com/questions/12062651/externalinterface-gives-me-an-option-of-stopping-the-script-when-using-multiple

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!