js调用flash中的方法
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