[英]HOw can I use ExternalInterface from my Flash AS2 swf in an iFrame to call a javascript method?
I have a PHP script which includes a header file (header.php) which includes a javascript file containing some javascript methods.我有一个 PHP 脚本,其中包括一个 header 文件(header.php),其中包括一个 javascript 文件,其中包含一些 ZDE9B9ED708D7E2E19ZEEFF 方法。
ie - IE -
Main.php => Main.php =>
include("header.php");
// This page also embeds a swf in an iFrame (myFlash.swf)
header.php => header.php =>
<html>
<head>
<script type="text/javascript" src="javascript_methods.js"></script>
</head>
<body>
javascript_methods.js => javascript_methods.js =>
myFunction() {
alert("function called");
}
myFlash.swf => myFlash.swf =>
import flash.external.ExternalInterface;
//When I want to call the javascript function myFunction() -
ExternalInterface.call("myFunction");
I have used ExternalInterface elesewhere in my app and (think) i did it the same way but the only difference is this time the swf is inside an iFrame so think this might be causing the problem.我在我的应用程序的其他地方使用了 ExternalInterface 并且(认为)我也是这样做的,但唯一的区别是这次 swf 在 iFrame 内,所以认为这可能会导致问题。 Is there a solution to making this communication to javascript from Flash through an iFrame, or is this not the issue and I have a problem somewhere else.是否有解决方案可以通过 iFrame 从 Flash 与 javascript 进行通信,或者这不是问题,我在其他地方有问题。
thanks谢谢
The argument passed to ExternalInterface.call
will be eval
ed in the document where the flash is placed.传递给ExternalInterface.call
的参数将在放置eval
的文档中进行评估。 This means that for this flash to reach the parent windows code, then it needs to do这意味着对于这个 flash 到达父 windows 代码,那么它需要做
ExternalInterface.call("window.parent.myFunction");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.