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