向Flash传值的两种方式

向Flash传值的两种方式

1、flashname.swf?p1=1&p2=11
2、FlashVars
两者也可以混合使用

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="300" height="30">
  <param name="movie" value="gp4.swf?p1=1&p2=2" />
  <param name="quality" value="high" />
  <param name="FlashVars" value="p3=3&p4=4" />
  <embed src=\'#\'" style="color: #ff0000">gp4.swf?p1=1&p2=2" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="30" FlashVars="p3=3&p4=4"></embed>
</object>


采用swfobject.js的方式加载swf,swfobject.js是Adobe提供的网页嵌入Flash的标准JS文件,可以兼容各种浏览器。
<div id="my_chart"></div>
<script type="text/javascript">
swfobject.embedSWF("gp4.swf?p3=3&p4=4", "my_chart", "300", "30", "9.0.0", "expressInstall.swf", {"p1":"1","p2":"2"} );
</script>

注:{"p1":"1","p2":"2"}中p1、p2的引号可以省略

参考:http://zwnjava.iteye.com/blog/618303
 

你可能感兴趣的:(Flash,传值)