问题描述
|
我有一个PHP脚本,其中包括一个头文件(header.php),其中包括一个包含一些javascript方法的javascript文件。
即-
Main.php =>
include(\"header.php\");
// This page also embeds a swf in an iFrame (myFlash.swf)
header.php =>
<html>
<head>
<script type=\"text/javascript\" src=\"javascript_methods.js\"></script>
</head>
<body>
javascript_methods.js =>
myFunction() {
alert(\"function called\");
}
myFlash.swf =>
import flash.external.ExternalInterface;
//When I want to call the javascript function myFunction() -
ExternalInterface.call(\"myFunction\");
我在我的应用程序中使用过ExternalInterface elesewhere,并且(认为)我以相同的方式进行操作,但是唯一的区别是这次SWF位于iFrame内,因此认为这可能会导致问题。是否有解决方案,可以通过iFrame从Flash与javascript进行通信,还是这不是问题,而我在其他地方有问题。
谢谢
解决方法
传递给“ 4”的参数将在放置闪光灯的文档中“ 5”。这意味着要使此Flash到达父Windows代码,则需要这样做
ExternalInterface.call(\"window.parent.myFunction\");