Asp.net+xml+flash implementation of the picture display effect example _ practical skills

Source: Internet
Author: User

The example of this article describes the Asp.net+xml+flash implementation of the picture display effect. Share to everyone for your reference, specific as follows:

First step: Introduce namespaces first: (in VS08 environment)

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; (to be introduced)
using System.Xml;//(to be introduced)

Step two: Use of front page (index.swf file required):

<div align= "center" id= "Qiyeyuangong" style= "Float:left" 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>

Step three: Generate XML file methods:

Generate XML file public void Xmlgetpic () {//delete slides.xml file 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");//define the picture displayed from the distance to the left of the flash writer. WriteAttributeString ("rightpadding", "0");//define the picture displayed from the distance to the right of the 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)//Small picture address writer. WriteAttributeString ("D_url", stroldimg);//Large picture address writer.
          WriteAttributeString ("transition", "0"); Writer.
          WriteAttributeString ("Panzoom", "1"); Writer.
          WriteAttributeString ("Urltarget", "0"); Writer. WriteAttributeString ("Phototime", "5"),//define the speed of the picture switch, the larger the number, the slower the switching speed writer.
          WriteAttributeString ("url", ""); Writer.
          WriteAttributeString ("title", "xxjpm2c000801_20080809_mvpfn1a001"); Writer.
          WriteAttributeString ("width", "710"); Writer.
          WriteAttributeString ("height", "625"); Writer. Writecdata ("    ") + strtitle+ "" "+ strfcxxms);//Display the description information for each picture writer.
        WriteEndElement (); } writer.
      WriteEndElement (); } writer.
      WriteEndElement (); Writer.
      WriteEndDocument (); Writer.
    Close ();

 }
}

The effect is shown in the following illustration:

More interested readers of asp.net related content can view the site topics: "asp.net operation JSON tips summary", "asp.net string operation tips Summary", "ASP.net Operation XML Skills summary", "asp.net file Operation skills Summary", " asp.net Ajax Skills Summary topic and the "ASP.net cache operation skills Summary."

I hope this article will help you to ASP.net program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.