以flash翻页方式展现图片的实现

index.aspx前台:      

<div id="ShowAD">
                    <script type="text/javascript" language="javascript">
                        var pic_width=698 //图片宽度
                        var pic_height=184 //图片高度
                        var swfpath = 'picviewer.swf' //swf文件路径地址,需要'picviewer.swf文件置于index.aspx文件同一级别目录下 

                        var swf_height = 184
                        var pics='<%=BindADOne() %>';// 得到 var pics='ImageAD/01.jpg|ImageAD/02.jpg|ImageAD/03.jpg|ImageAD/04.jpg';
                        var links='<%=BindADTwo() %>';  // 得到 var links='Item.aspx?Id=2|Item.aspx?Id=2|Item.aspx?Id=2|Item.aspx?Id=2'; 
                        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="'+ pic_width +'" height="'+ swf_height +'">');
                        document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+swfpath+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
                        document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
                        document.write('<param name="FlashVars" value="pics='+ pics +'&links='+ links +'&borderwidth='+pic_width+'&borderheight='+pic_height+'">');
                        document.write('<embed src="'+swfpath+'" wmode="opaque" FlashVars="pics='+ pics +'&links='+ links +'&borderwidth='+pic_width+'&borderheight='+pic_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ pic_width +'" height="'+ pic_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
                        document.write('</object>');
                    </script>
                </div>

 

index.aspx后台:      

public string BindADOne() {

        string txtPath = Server.MapPath("App_Data/ad.xml");
        string reImage=string.Empty;
        XmlDocument doc = new XmlDocument();
        doc.Load(txtPath);
        XmlNodeList listImage = doc.GetElementsByTagName("Image");

        foreach (XmlNode node in listImage) {

            reImage += node.InnerText.ToString() + "|";
       
        }
        txtImage = reImage.Substring(0,reImage.LastIndexOf("|"));
        return txtImage;
   
    }
    public string BindADTwo()
    {
        string txtPath = Server.MapPath("App_Data/ad.xml");
        string reLink = string.Empty;
        XmlDocument doc = new XmlDocument();
        doc.Load(txtPath);
        XmlNodeList listLink = doc.GetElementsByTagName("ImageLink");

        foreach (XmlNode nodeLink in listLink)
        {

            reLink += nodeLink.InnerText + "|";

        }
        txtLink = reLink.Substring(0,reLink.LastIndexOf("|"));
        return txtLink;

    }

 

App_Data/ad.xml:

<?xml version="1.0" encoding="gb2312"?>
<IndexAd>
<ad>
<Id>1</Id>
<Name>图片1</Name>
<Image>ImageAD/01.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
<ad>
<Id>2</Id>
<Name>图片2</Name>
<Image>ImageAD/02.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
<ad>
<Id>3</Id>
<Name>图片3</Name>
<Image>ImageAD/03.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
<ad>
<Id>4</Id>
<Name>图片4</Name>
<Image>ImageAD/04.jpg</Image>
<ImageLink>Item.aspx?Id=2</ImageLink>
</ad>
</IndexAd>

 

picviewer.swf:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值