js调用flash中的方法

kingagile 2012-12-19 10:46:30
1.html代码
------------------------------
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="myswf" width="510" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
<param name="movie" value="../images/flash.swf" />
<param name=FlashVars />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="images/flash1.swf" quality="high" wmode="transparent" width=510 height=510 name=flashvars type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer>
</embed>
</object>
</div>

<script language="javascript" type="text/javascript">
function btnOK() {
thisMovie("myswf").begin();
}

function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName]
}
}
</script>
----------------------------------------

2.这是flash中的脚本
------------------------------------------
//导入ExternalInterface类
import flash.external.ExternalInterface;
//这个参数是说js里调用as里的函数名
var methodName:String = "begin";
//这个是在该方法中被解析的对象,就是函数里的this 指向谁
var instance:Object = null;
//允许js中的flAlert()调用flash中的showAlert()
ExternalInterface.addCallback(methodName,instance,start);

function start()
{
btnWait._alpha = 100;
btnStart._alpha = 0;
btnSuc._alpha = 0;
btn_mc._visible = false;
if (count < turns)
{
_root.pointer._rotation = _root.pointer._rotation + 12 * count;
if (_root.pointer._rotation == 0)
{
count = count + 1;
} // end if
}
else if (count2 > 0)
{
_root.pointer._rotation = _root.pointer._rotation + 12 * count2;
if (_root.pointer._rotation == 0)
{
count2 = count2 - 1;
} // end if
}
else
{
_root.pointer._rotation = _root.pointer._rotation + 12;
if (_root.pointer._rotation == 360 / totleNum * (stopNum - 1) || _root.pointer._rotation == 360 / totleNum * (stopNum - 1) - 360)
{
_root.pointer._rotation = 360 / totleNum * (stopNum - 1);
clearInterval(t);
btnSuc._alpha = 100;
btnWait._alpha = 0;
getURL("javascript:flashOver(" + stopNum + ")", "");
} // end else if
} // end else if
} // End of the function

------------------------------
我这样写的调不了start方法,试了好多次都不行
...全文
184 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

2,275

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计/Flash/Silverlight 开发 Flash流媒体开发
社区管理员
  • Flash流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧