Flash與Javascript之間的交互(IE和NetScape下都能實現) 代碼如下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>flash fscommand 測試</title>
<script language="javascript" type="text/javascript">
function flashJS_DoFSCommand(command,args){
alert(command+" "+args);//讀取參數信息
}
if(document.all !=null){
document.writeln("<script language='vbscript' type='text/vbscript'/>");
document.writeln("sub flashJS_FSCommand(ByVal command,ByVal args)");
document.writeln(" call flashJS_DoFSCommand(command,args)");
document.writeln("End sub");
document.writeln("</script/>");
}
</script>
</head>
<body>
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:863px; height:575px; z-index:1">
<object id="flashJS" name="flashJS" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="863" height="575">
<param name="movie" value="fscommandJS.swf">
<param name="quality" value="high">
<embed NAME="flashJS" swLiveConnect="true" src="fscommandJS.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="863" height="575"></embed>
</object>
</div>
</body>
</html>
說明粉紅色部分是在IE瀏覽器下能運行的代碼,橙紅色部分Firefox下能運行的代碼
參考Macromedia的文檔
http://www.adobe.com/cn/support/flash/ts/documents/javascript_comm.htm