
flash切换代码可以从 http://www.zcool.com.cn/jscode/ggcode/20070925/code_09252CH007.html
进行下载
下载完成以后可以看到有一个index.htm里面有下面的一段
<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="420" height="240">
<param name="movie" value="flash/main_new.swf">
<param name="quality" value="high">
<embed src="flash/movie.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="420" height="240"></embed>
</object>
现在我们要用swfobject来进行替换。首先建议参看一下swfobject的帮助
http://hi.baidu.com/x2p2/blog/item/5031e2b47a1e65768ad4b220.html
参看下面的实现代码发现是否简单和简洁多了!!!
红色部分为swfobject的使用范例
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" language="javascript" src="js/swfobject.js"></script>
</head>
<body>
<div id="flashcontent">
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("images/v1/flash/main_new.swf", "sotester", "348", "195", "9", "#FF6600");
so.addVariable("flashVarText", "this is passed in via FlashVars for example only"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
so.write("flashcontent");
// ]]>
</script>
</div>
</body>
</html>
另外一个很好的例子可以参看 http://www.blueidea.com/download/product/2007/4440.asp
这很经典的,叫做Bcaster参看http://www.ruochigroup.com/main/
可以下载下来,里面有一个“不需要激活的样本.htm" 里面有一个简单的例子。
在这里我希望仅仅是修改XML就可以了那么代码修改如下
<div id="flashcontent">
This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
<!--
var swf_width=281
var swf_height=192
var so = new SWFObject("bcastr3.swf", "mymovie", swf_width, swf_height, "8");
so.addVariable("bcastr_xml_url","bcastr.xml");
so.write("flashcontent");
</script>