本来是这样的
<script type="text/javascript">
imgUrl1="images/01.jpg";
imgtext1="试着这样把你忘记";
imgUrl2="images/02.jpg";
imgtext2="迷茫";
imgUrl3="images/03.jpg";
imgtext3="恋文";
var focus_width=240;
var focus_height=200;
var text_height=18;
var swf_height = focus_height+text_height ;
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3;
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3;
document.write('<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="focus.swf"> <param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
</script>
以上的脚本可以实现滚动图片播放器的效果,现在想通过c# .cs文件动态给动态图片进行更新
代码如下:
void Page_Load(object sender, EventArgs e)
{
StringBuilder texts = new StringBuilder();
StringBuilder paths = new StringBuilder();
XmlDocument doc = new XmlDocument();
string str = Server.MapPath("~/picture.xml");
doc.Load(str);
int i;
XmlNode node;
XmlElement pic = doc.DocumentElement;//取出pic的节点
for (i = 0; i < pic.ChildNodes.Count - 1; i++)
{
node = pic.ChildNodes[i];
texts.Append(node.ChildNodes[0].InnerText);
texts.Append("|");
paths.Append(node.ChildNodes[1].InnerText);
paths.Append("|");
}
node = pic.ChildNodes[i];
texts.Append(node.ChildNodes[0].InnerText);
paths.Append(node.ChildNodes[1].InnerText);
int focus_width = 240;
int focus_height = 200;
int text_height = 18;
int swf_height = focus_height + text_height;
StringBuilder script = new StringBuilder();
script.Append("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"" + focus_width + "\"" + " height=\"" + swf_height + "\"/>");
script.Append("<param name=\"allowScriptAccess\" value=\"sameDomain\"/> <param name=\"movie\" value=\"focus.swf\"/><param name=\"quality\" value=\"high\"/><param name=\"bgcolor\" value=\"#F0F0F0\"/>");
script.Append("<param name=\"menu\" value=\"false\"/><param name=\"wmode\" value=\"opaque\"/>");
script.Append("<param name=\"FlashVars\" value=\"paths=" + paths + " &texts=" + texts + " &borderwidth=" + focus_width + " &borderheight=" + focus_height + " &textheight=" + text_height + "\"/>");
script.Append("<embed src=\"pixviewer.swf\" wmode=\"opaque\" FlashVars=\"paths=" + paths + " &texts=" + texts + " &borderwidth=" + focus_width + " &borderheight=" + focus_height + " &textheight=" + text_height + " \"menu=\"false\" bgcolor=\"#F0F0F0\" quality=\"high\" width=\"" + focus_width + " \" height=\"" + focus_height + " \"allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"/>");
script.Append("</object>");
this.Response.Write(script);
}
下面是myscript单步调试时 myscript的内容,希望有些用处
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
width="240" height="218" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="focus.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#F0F0F0" />
<param name="menu" value="false" />
<param name="wmode" value="opaque" />
<param name="FlashVars" value="paths=images/01.jpg|images/04.jpg|images/02.jpg|images/03.jpg|images/05.jpg &links=www.sina.com|www.sina.com|www.sina.com|www.sina.com|www.sina.com &texts=试着这样把你忘记|迷茫|恋文|毁灭|那年我们很相爱 &borderwidth=240 &borderheight=200 &textheight=18" />
<embed src="pixviewer.swf" wmode="opaque" flashvars="paths=images/01.jpg|images/04.jpg|images/02.jpg|images/03.jpg|images/05.jpg &links=www.sina.com|www.sina.com|www.sina.com|www.sina.com|www.sina.com &texts=试着这样把你忘记|迷茫|恋文|毁灭|那年我们很相爱 &borderwidth=240 &borderheight=200 &textheight=18 "
menu="false" bgcolor="#F0F0F0" quality="high" width="240 " height="200 " allowscriptaccess="sameDomain"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
运行结果不对,图片不能滚动,找了好久也没找出问题,请大家帮忙指点一下;谢谢了