aspx中添加Flash

方法一:

1.先见一个flash.cs类文件

using System;
using System.Web.UI;

namespace Unicorn.WebControls
{
    public class Flash : Control
    {
        private string _src;
        private string _width;
        private string _height;

        public string Width
        {
            get { return _width; }
            set { _width = value; }
        }

        public string Height
        {
            get { return _height; }
            set { _height = value; }
        }

        public string Src
        {
            get { return _src; }
            set { _src = value; }
        }

        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            writer.Write(@"
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0'
    width='{1}' height='{2}'>
    <param name='movie' value='{0}' />
    <param name='quality' value='high' />
    <embed src='{0}' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'
    width='{1}' height='{2}'></embed>
</object>", this.Src, this.Width, this.Height);
        }
    }
}

 

 

2.web.config配置文件里面加上一句:

<pages>
        <controls>
          <!--如果flash.cs 放在另一個名為unicorn的專案-->
          <!--<add tagPrefix="uni" namespace="Unicorn.WebControls" assembly="unicorn" />-->
          <!--如果flash.cs 放在App_Code裏面-->
          <add tagPrefix="uni" namespace="Unicorn.WebControls" />
        </controls>
      </pages>

 

 

3.就可以在你想加入flash的地方加上引用的语句:

<uni:Flash ID="Flash2" runat="server" Width="1024" Height="768" Src="load.swf"></uni:Flash>

 

方法二:

<object   classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="1004" height="167">
    <param   name="movie"       value="swf的地址">                                              
    <param   name="quality"   value="high">
    <param name="wmode" value="opaque">
    <param   name="SCALE"   value="exactfit">
    <embed   src="swf的地址"   width="1004"   height="167" wmode="opaque"   
    quality="high"   pluginspage="http://www.macromedia.com/go/getflashplayer"  
    type="application/x-shockwave-flash"   scale="exactfit"></embed>  
    </object>

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭