Note: Use this code @ your own risk.
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.ComponentModel;
namespace FlashWebPart {
public class FlashWebPart : WebPart {
private int flashWidth;
private int flashHeight;
private string flashUrl;
[Personalizable(PersonalizationScope.Shared),
WebBrowsable(true),
WebDisplayName("Width"),
WebDescription("Width of the flash"),
Category("Configuration")]
public int FlashWidth
{
get { return flashWidth; }
set { flashWidth = value; }
}
[Personalizable(PersonalizationScope.Shared),
WebBrowsable(true),
WebDisplayName("Height"),
WebDescription("Height of the flash"),
Category("Configuration")]
public int FlashHeight
{
get { return flashHeight; }
set { flashHeight = value; }
}
[Personalizable(PersonalizationScope.Shared),
WebBrowsable(true),
WebDisplayName("URL"),
WebDescription("Url of the flash file"),
Category("Configuration")]
public string FlashUrl
{
get { return flashUrl; }
set { flashUrl = value; }
}
protected override void Render(HtmlTextWriter writer)
{
if (!String.IsNullOrEmpty(FlashUrl))
{
string outHTML = “<OBJECT classid=\”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\” ” + “codebase=\”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,12,36\” ” + “WIDTH=” + flashWidth + ” HEIGHT=” + flashHeight + “> ” + “<PARAM NAME=movie VALUE=\”" + flashUrl + “\”> ” + “<PARAM NAME=WMODE VALUE=\”Transparent\”>” + “<PARAM NAME=quality VALUE=high> ” + “<EMBED src=\”" + flashUrl + “\” quality=high wmode=\”transparent\” WIDTH=\”" + flashWidth + “\” HEIGHT=\”" + flashHeight + “\” TYPE=\”application/x-shockwave-flash\” PLUGINSPAGE=\”http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\”></EMBED> ” + “</OBJECT>”;
writer.Write(outHTML);
}
else
{
writer.Write(“Modify Webpart to add content URL”);
}
}
}
}