ExternalInterface gives me an option of stopping t

2019-07-05 19:43发布

问题:

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