c# web 后台代码嵌入flash

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
namespace FlashPlayer
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string strWidth = "500";//the width of flash
            string strHeight = "200";//the height of flash
            string strPath = @"swf/50.swf";//the path of flash
            this.FindControl("ContentPanel").Controls.Add(new LiteralControl(ProduceFlashPlayer(strWidth,strHeight,strPath).ToString()));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private StringBuilder ProduceFlashPlayer(string strWidth,string strHeight,string strPath)
        {
            StringBuilder sbFlashPlayer = new StringBuilder();
            string strFlashPlayerFormat="<object id='FlashID' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='{0}' height='{1}'>"
            + "<param name='movie' value='{2}' />"
            + "<param name='quality' value='high' />"
            + "<param name='wmode' value='opaque' />"
            + "<param name='swfversion' value='6.0.65.0' />"
            + "<param name='expressinstall' value='Scripts/expressInstall.swf' />"
            + "<!--[if !IE]>-->"
            + "<object type='application/x-shockwave-flash' data='{2}' width='{0}' height='{1}'>"
            + "<!--<![endif]-->"
            + "<param name='quality' value='high' />"
            + "<param name='wmode' value='opaque' />"
            + "<param name='swfversion' value='6.0.65.0' />"
            + "<param name='expressinstall' value='Scripts/expressInstall.swf' />"
            + "<div>"
            + "<p><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='获取 Adobe Flash Player' width='112' height='33' /></a></p>"
            + "</div>"
            + "<!--[if !IE]>-->"
            + "</object>"
            + "<!--<![endif]-->"
            + "</object>"
            + "<script type='text/javascript'>"
            + "<!--"
            + "swfobject.registerObject('FlashID');"
            + "//-->"
            + "</script>";
            sbFlashPlayer.AppendFormat(strFlashPlayerFormat, strWidth, strHeight, strPath);
            return sbFlashPlayer;
        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值