Flash images effect implementation (original)

Source: Internet
Author: User

Some time ago,Many websitesFlash ImagesNews,Very good results.At that time, I was very interested.,I want to study how this effect is achieved..ThereforeGoogleAh,What I want is not foundSource code,Or in a group,A netizen gave a colleague from their company a section that was previously usedCode;But another disappointment is that,The code isJavascriptStatic Implementation of image scrolling news;But we can't make it static in practical applications.,In this way, flexibility is lost...

I will study it myself,Change it to dynamically fetch data from the database;Haha, finally let me make it,The effect is not bad. Now let's share it with everyone.,Hope to help friends who need it.

First look at the effect:

Front-end code:

<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "default. aspx. cs" inherits = "imasges_news. _ default" %>

<% @ Import namespace = "imasges_news.sqlhelp" %>

<% @ Import namespace = "system. Data" %>

<! Doctype HTML public "-// W 3c // Dtd xhtml 1.0 transitional // en "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

 

<HTML xmlns = "http://www.w3.org/1999/xhtml">

<Head runat = "server">

<Title>No title page</Title>

</Head>

<Body>

<Form ID = "A" runat = "server">

<SPAN class = "f14b">

<SCRIPT type = "text/JavaScript">

VaR focus_width = 240

VaR focus_height = 200

VaR text_height = 18

VaR swf_height = focus_height + text_height

VaR pics = "<% = return_pics () %> ";

VaR links = "<% = return_links () %> ";

VaR texts = "<% = return_texts () %> ";

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 = "Flash/focus.swf"> <Param name = "quality" value = "high"> <Param name = "bgcolor" value = "# F 0f 0f 0 "> ');

Document. Write ('<Param name = "menu" value = "false"> <Param name = wmode value = "Opaque"> ');

Document. write ('<Param name = "flashvars" value = "pics =' + pics + '& links =' + Links + '& texts =' + texts + '& borderwidth =' + focus_width + '& borderheight =' + focus_height + '& textheight =' + text_height + '"> ');

Document. write ('<embed src = "pixviewer.swf" wmode = "Opaque" flashvars = "pics =' + pics + '& links =' + Links + '& texts =' + texts + '& borderwidth =' + focus_width + '& borderheight =' + focus_height + '& textheight =' + text_height + '"menu =" false "bgcolor =" # F 0f 0f 0 "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>

 

</Form>

</Body>

</Html>

 

Background code:

Using system;

Using system. Data;

Using system. configuration;

Using system. collections;

Using system. Web;

Using system. Web. Security;

Using system. Web. UI;

Using system. Web. UI. webcontrols;

Using system. Web. UI. webcontrols. webparts;

Using system. Web. UI. htmlcontrols;

Using imasges_news.sqlhelp;

 

Namespace imasges_news

{

// Author: ziyan22

// Createdate: 2007-07-01

// Content: Flash Image

Public partial class _ default: system. Web. UI. Page

{

Public datatable DT;

Protected void page_load (Object sender, eventargs E)

{

If (! Page. ispostback)

{

Sys_mess ();

}

}

 

Public void sys_mess ()

{

String connstring = system. configuration. configurationsettings. appsettings ["sqlconn"]. tostring (). Trim ();

Dbutil;

Dbutil = new dbutil (connstring );

System. Data. dataset Ds;

DS = new dataset ();

DS = dbutil. select_news ();

Dt = Ds. Tables [0];

}

Public String return_pics ()

{

String imagesurl = "";

Int I;

For (I = 0; I <DT. Rows. Count ;)

{

If (imagesurl! = "")

{

Imagesurl = imagesurl + "|" + dt. Rows [I] ["imgurl"]. tostring ();

}

Else

{

Imagesurl = imagesurl + dt. Rows [I] ["imgurl"]. tostring ();

}

I ++;

}

 Return imagesurl;

}

Public String return_links ()

{

String imglink = "";

Int J;

For (j = 0; j <DT. Rows. Count ;)

{

If (imglink! = "")

{

Imglink = imglink + "|" + dt. Rows [J] ["imglink"]. tostring ();

}

Else

{

Imglink = imglink + dt. Rows [J] ["imglink"]. tostring ();

}

J ++;

}

Return imglink;

}

 

Public String return_texts ()

{

String imgtext = "";

Int N;

For (n = 0; n <DT. Rows. Count ;)

{

If (imgtext! = "")

{

Imgtext = imgtext + "|" + dt. Rows [N] ["imgtext"]. tostring ();

}

Else

{

Imgtext = imgtext + dt. Rows [N] ["imgtext"]. tostring ();

}

N ++;

}

Return imgtext;

}

 

Protected void textbox4_textchanged (Object sender, eventargs E)

{

 

}

}

}

Table Structure:

Create Table [DBO]. [imagesnews] (

[ID] [int] identity (1, 1) not null,

[Imgurl] [varchar] (50) Collate chinese_prc_ci_as null,

[Imgtext] [varchar] (50) Collate chinese_prc_ci_as null,

[Imglink] [varchar] (50) Collate chinese_prc_ci_as null

) On [primary]

Go

The download of the code package is not provided. The space is limited after all. If necessary, leave a message,EmailGive it to him.

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.