小編給大家分享一下asp.net+xml+flash如何實(shí)現(xiàn)圖片展示效果,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),同心企業(yè)網(wǎng)站建設(shè),同心品牌網(wǎng)站建設(shè),網(wǎng)站定制,同心網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,同心網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。具體如下:
第一步:首先引入命名空間:(vs08環(huán)境中)
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Text; //(需要引入的) using System.Xml; //(需要引入的)
第二步:前臺(tái)頁面的使用(需要index.swf文件):
<div align="center" id="qiyeyuangong" runat="server"> <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="710" height="625" id="tech" align="middle" > <param name="wmode" value="transparent"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="index.swf?xml_path=slides.xml" /> <param name="quality" value="high" /> <embed src="index.swf?xml_path=slides.xml" quality="high" width="710" height="625" name="tech" align="middle" wmode="transparent" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </embed> </object> </div>
第三步:生成xml文件方法:
//生成Xml文件 public void xmlGetPic() { //刪除slides.xml文件 string fileXml = "slides.xml"; //if (File.Exists(Server.MapPath(fileXml))) //{ // File.Delete(Server.MapPath(fileXml)); //} if (!File.Exists(Server.MapPath(fileXml))) { // Create a new XmlTextWriter instance XmlTextWriter writer = new XmlTextWriter(Server.MapPath("slides.xml"), Encoding.UTF8); // start writing! writer.WriteStartDocument(); writer.WriteStartElement("flash_parameters"); writer.WriteStartElement("preferences"); writer.WriteStartElement("global"); writer.WriteStartElement("basic_property"); writer.WriteAttributeString("movieWidth", "710"); writer.WriteAttributeString("movieHeight", "625"); writer.WriteAttributeString("html_title", "Title"); writer.WriteAttributeString("loadStyle", "Pie"); writer.WriteAttributeString("startAutoPlay", "true"); writer.WriteAttributeString("backgroundColor", "0xffffff"); writer.WriteAttributeString("anvsoftMenu", "false"); writer.WriteAttributeString("hideAdobeMenu", "false"); writer.WriteAttributeString("photoDynamicShow", "true"); writer.WriteAttributeString("enableURL", "true"); writer.WriteAttributeString("transitionArray", ""); writer.WriteEndElement(); writer.WriteStartElement("title_property"); writer.WriteAttributeString("photoTitle", "false"); writer.WriteAttributeString("photoTitleX", "5"); writer.WriteAttributeString("photoTitleY", "5"); writer.WriteAttributeString("photoTitleSize", "15"); writer.WriteAttributeString("photoTitleFont", "Verdana"); writer.WriteAttributeString("photoTitleColor", "0xffffff"); writer.WriteEndElement(); writer.WriteStartElement("music_property"); writer.WriteAttributeString("path", ""); writer.WriteAttributeString("stream", "true"); writer.WriteAttributeString("loop", "true"); writer.WriteEndElement(); writer.WriteStartElement("photo_property"); writer.WriteAttributeString("topPadding", "0"); writer.WriteAttributeString("bottomPadding", "65"); writer.WriteAttributeString("leftPadding", "0");//定義顯示的圖片距離flash左邊的距離 writer.WriteAttributeString("rightPadding", "0");//定義顯示的圖片距離flash右邊的距離 writer.WriteEndElement(); writer.WriteStartElement("frame_property"); writer.WriteAttributeString("frameColor", "0x000000"); writer.WriteEndElement(); writer.WriteStartElement("properties"); writer.WriteAttributeString("enable", "true"); writer.WriteAttributeString("backgroundColor", "0xffffff"); writer.WriteAttributeString("backgroundAlpha", "50"); writer.WriteAttributeString("cssText", "a:link{text-decoration: underline;} a:hover{color:#ff0000; text-decoration: none;} a:active{color:#0000ff;text-decoration: none;} .blue {color:#0000ff; font-size:15px; font-style:italic; text-decoration: underline;} .body{color:#ff5500;font-size:20px;}"); writer.WriteAttributeString("align", "bottom"); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteStartElement("thumbnail"); writer.WriteStartElement("basic_property"); writer.WriteAttributeString("backgroundColor", "0x3c3c3c"); writer.WriteAttributeString("buttonColor", "0x000000"); writer.WriteAttributeString("borderColor", "0xb3b3b3"); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); int intCount = gs.allQiYeFCInfo().Tables[0].Rows.Count; string strOldImg; string strNewImg; string strTitle; string strFCXxms; if (intCount == 0) { qiyeyuangong.Visible = false; } if (intCount > 0) { writer.WriteStartElement("album"); for (int i = 0; i < intCount; i++) { strOldImg = gs.allQiYeFCInfo().Tables[0].Rows[i]["fcimagepath"].ToString().Replace("~/", ""); strNewImg = gs.allQiYeFCInfo().Tables[0].Rows[i]["fcnewimage"].ToString().Replace("~/", ""); strTitle = gs.allQiYeFCInfo().Tables[0].Rows[i]["fctitle"].ToString(); strFCXxms = gs.allQiYeFCInfo().Tables[0].Rows[i]["fcxxms"].ToString(); writer.WriteStartElement("slide"); writer.WriteAttributeString("jpegURL", strNewImg);//小圖片地址 writer.WriteAttributeString("d_URL", strOldImg);//大圖片地址 writer.WriteAttributeString("transition", "0"); writer.WriteAttributeString("panzoom", "1"); writer.WriteAttributeString("URLTarget", "0"); writer.WriteAttributeString("phototime", "5");//定義圖片切換的速度,數(shù)字越大,切換速度越慢 writer.WriteAttributeString("url", ""); writer.WriteAttributeString("title", "Xxjpm2C000801_20080809_MVPFN1A001"); writer.WriteAttributeString("width", "710"); writer.WriteAttributeString("height", "625"); writer.WriteCData(" 【" + strTitle + "】" + strFCXxms);//顯示每張圖片的說明信息 writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); } }
效果如下圖所示:
看完了這篇文章,相信你對“asp.net+xml+flash如何實(shí)現(xiàn)圖片展示效果”有了一定的了解,如果想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!
分享標(biāo)題:asp.net+xml+flash如何實(shí)現(xiàn)圖片展示效果-創(chuàng)新互聯(lián)
文章出自:http://www.rwnh.cn/article38/cegssp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、微信小程序、企業(yè)建站、網(wǎng)站策劃、網(wǎng)站收錄、品牌網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容