【发布时间】:2011-03-31 04:58:53
【问题描述】:
我正在尝试通过 javascript 控制 Flash 播放器, 我做了我在互联网上看到的,我得到一个“不支持”的错误
这里是我写的:
关于js:
function getFlashMovieObject(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}
function SetNum1()
{
var x=getFlashMovieObject("flashmovie");
x.Setvariable("z0", "Z0");
//document.getElementById("flashmovie").setVariable("z0", "Z0");
alert("hi");
}
在 html 上:
<object id="flashmovie" width="40" height="300">
<param name="movie" value="complex Ex A2P.swf">
<embed src="complex Ex A2P.swf" width="400" height="300">
</embed>
</object>
注意:我尝试了“Setvariable”、“setvariable”、“SetVariable”和“setVariable”(大写字母的差异)
【问题讨论】:
-
你确定
complex Ex A2P.swf在你调用的时候被初始化了,你确定它拥有Setvariable方法吗? -
确保 setVariable 是您的 actionscript 代码中接受 2 个参数的函数。在 url 中放置空格也是不好的做法
标签: javascript flash actionscript externalinterface