在网页中插入透明的flash其实是非常简单的事,下面简单介绍;
1、制作或下载一个纯色背景的flash文件。
2、打开Dreamweaver(我使用的是Adobe Dreamweaver CS3),插入记录->媒体->Flash
3、然后选择你要插入的flash文件,即生成类似下面的代码和一个名为“AC_RunActiveContent.js”的文件:
<script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','980','height','131','src','images/8','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','images/8' ); //end AC code </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="980" height="131"> <param name="movie" value="images/8.swf" /> <param name="quality" value="high" /> <embed src="images/8.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="980" height="131"></embed> </object> </noscript>
4、在这段代码中添加一个参数“wmode” 值为“transparent”,代码变化如下
<script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','980','height','131','src','images/8','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','images/8' ); //end AC code </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="980" height="131"> <param name="movie" value="images/8.swf" /> <param name="quality" value="high" /> <param name="wmode" value="transparent" /> <embed src="images/8.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="980" height="131" wmode="transparent"></embed> </object> </noscript>
(1)添加<param name="wmode" value="transparent" />
(2)在最后添加wmode="transparent"
5、保存预览吧
以上是用Dreamweaver控件插入的,也可以把代码简化,直接把下面的代码黏贴进去,替换flash路径、width和height。
<embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="images/top.swf" type="application/x-shockwave-flash" width="960" height="180" wmode="transparent" quality="high"></embed>