
1个回答
展开全部
可以使用<object>+<embed>组合
<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="475" height="71">
<param name="movie" value="http://56.16.191.80/images/banner/banner-logo.swf">
<param name="quality" value="high">
<embed src="/*FLASH地址*/" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="475" height="71"></embed></object>
如果你要添加其他效果可以查查embed的属性
不过ASP.NET中不支持这个标签 但是能正常运行
如果你觉得看得心烦 就做成webcontrl 就不会提示错误
我有现成代码
插入flash时,就用以下的语法
<uni:Flash runat="server" Width="221" Height="136" Src="flash/logoB.swf"></uni:Flash>
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);
}
}
}
web.config加入相关的设定
<system.web>
<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>
</system.web>
<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="475" height="71">
<param name="movie" value="http://56.16.191.80/images/banner/banner-logo.swf">
<param name="quality" value="high">
<embed src="/*FLASH地址*/" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="475" height="71"></embed></object>
如果你要添加其他效果可以查查embed的属性
不过ASP.NET中不支持这个标签 但是能正常运行
如果你觉得看得心烦 就做成webcontrl 就不会提示错误
我有现成代码
插入flash时,就用以下的语法
<uni:Flash runat="server" Width="221" Height="136" Src="flash/logoB.swf"></uni:Flash>
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);
}
}
}
web.config加入相关的设定
<system.web>
<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>
</system.web>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询