Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.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 如何让flash重新加载它嵌入的父HTML页面?_Javascript_Html_Flash_Actionscript - Fatal编程技术网

Javascript 如何让flash重新加载它嵌入的父HTML页面?

Javascript 如何让flash重新加载它嵌入的父HTML页面?,javascript,html,flash,actionscript,Javascript,Html,Flash,Actionscript,我有一个flash应用程序(SWF),运行嵌入HTML页面的flash 8。如何让flash重新加载它嵌入的父HTML页面?我曾尝试使用ExternalInterface调用JavaScript函数来重新加载页面,但这似乎不起作用。 试着这样做: getURL(“javascript:location.reload(true)”检查动作脚本。使用此函数,您可以调用代码中的任何JavaScript函数: if (ExternalInterface.available) { var

我有一个flash应用程序(SWF),运行嵌入HTML页面的flash 8。如何让flash重新加载它嵌入的父HTML页面?我曾尝试使用ExternalInterface调用JavaScript函数来重新加载页面,但这似乎不起作用。
试着这样做:

getURL(“javascript:location.reload(true)”

检查动作脚本。使用此函数,您可以调用代码中的任何JavaScript函数:

  if (ExternalInterface.available)
  {
    var result = ExternalInterface.call("reload");
  }
在嵌入HTML代码中,输入JavaScript函数:

  function reload()
  {
    document.location.reload(true);
    return true;
  }

这样做的好处是,您还可以检查函数调用是否成功,并相应地执行操作。getUrl以及对JavaScript的调用现在不应该再使用了。这是一个老问题。

在Flash 10中,您可以执行以下操作:

navigateToURL(new URLRequest("path_to_page"), "_self");

快速脏:这在大多数情况下都有效(根本不修改HTML页面):


简单的单线解决方案

ExternalInterface.call("document.location.reload", true);
ExternalInterface.call("document.location.reload", true);