我是整个动作脚本/Flash 世界的新手……但我试图自学足以完成一些事情。
我确信这个问题的答案很简单......但我有一个 .as 文件,其中包含以下代码:
package
{
import flash.external.ExternalInterface;
public class Sender
{
public function Sender()
{
ExternalInterface.call("func1()");
}
}
}
我有一个带有以下代码的 fla(我什么都没碰过):
import Sender;
var mySender:Sender = new Sender();
现在发布后,我对 html 文件(包括在下面)进行了一些调整......并且我的 Javascript 被调用(耶!)。不幸的是,在解除警报后,它再次被调用......一次又一次......一次又一次。我不知道为什么(我已经确认我的 Flash 电影没有设置为循环播放,但这就是我所拥有的)。任何帮助将不胜感激!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>sender</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color: #ffffff;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>
<script>
function func1()
{
alert('hello external stuff');
}
</script>
</head>
<body>
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="1" height="1" id="sender" align="middle">
<param name="movie" value="sender.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="sender.swf" width="1" height="1">
<param name="movie" value="sender.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>