Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/383.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ExternalInterface为我提供了在使用多个参数时停止脚本的选项。为什么?_Javascript_Actionscript 3_Flash_Actionscript_Externalinterface - Fatal编程技术网

Javascript ExternalInterface为我提供了在使用多个参数时停止脚本的选项。为什么?

Javascript ExternalInterface为我提供了在使用多个参数时停止脚本的选项。为什么?,javascript,actionscript-3,flash,actionscript,externalinterface,Javascript,Actionscript 3,Flash,Actionscript,Externalinterface,第一版: ExternalInterface.call("$(document).trigger", "opened_file_chooser"); 第二版: ExternalInterface.call("$(document).trigger('opened_file_chooser')"); 如果我使用第一个版本,它比第二个版本慢得多。此外,浏览器会阻塞,几秒钟后Firefox会向我显示带有“脚本没有响应…”的对话框,并为我提供了停止该对话框的可能性。如果我使用第二个版本,对Javas

第一版:

ExternalInterface.call("$(document).trigger", "opened_file_chooser");
第二版:

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

如果我使用第一个版本,它比第二个版本慢得多。此外,浏览器会阻塞,几秒钟后Firefox会向我显示带有“脚本没有响应…”的对话框,并为我提供了停止该对话框的可能性。如果我使用第二个版本,对Javascript的调用是即时的。有没有办法让第一个和第二个一样有效?我认为它更干净(从代码的角度来看)。

尝试设置一个超时,让ExternalInterface“返回”到Flash,这将有助于阻止:

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

只是一个猜测,但由于外部接口调用是同步的,它可能在返回之前等待文件选择器的响应。第二个可能会起作用,因为它只是返回整个函数的对象?如果在浏览器的javascript控制台中执行这些语句,您是否注意到同样的缓慢?我不是JS专家,所以这两种说法之间的区别我不知道。但在我看来,如果不使用
ExternalInterface
并直接执行这些语句,这个问题也应该发生。@londondruges\u MediaServices调用ExternalInterface的两种方法不应该产生相同的结果吗?@SunilD,如何从浏览器控制台执行ExternalInterface.call?这是一个flash方法调用。如果使用中间人函数,它会改变什么吗?例如,函数openFileChooser(){$(document).trigger('opened_file_chooser');}-从flash调用它?使用单个函数作为外部接口调用通常更为简洁,因为如果需要更新javascript端,则不必重新编译flash端。