hi frds,
currently im designing a website for my project, for that im using master page, in that master page how to embed a flash , as wish i want to put that flash image
can any one help me for this and also to design a master pages
hi frds,
currently im designing a website for my project, for that im using master page, in that master page how to embed a flash , as wish i want to put that flash image
can any one help me for this and also to design a master pages
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Scott LyslePosted Jun 4, 2008, 11:05 PM
Build this as a custom control, set the filepath (without tildes ~ and remove any unnecessary slashes), and set the height and width to match the flash image as nearly as possible. You can then put the control in the master page and use it to display swf files:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.Design;
namespace PlayFlash
{
[ToolboxData("<{0}:FlashControl runat=server>{0}:FlashControl>")]
public class FlashControl : WebControl
{
#region "Declarations"
private string mFilePath;
#endregion
#region "Properties"
[Category("SWF Source File")]
[Browsable(true)]
[Description("Set path to SWF source file.")]
[Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string FilePath
{
get
{
return mFilePath;
}
set
{
mFilePath = value;
}
} // end FilePath property
#endregion
#region "Rendering"
protected override void RenderContents(HtmlTextWriter writer)
{
try
{
if (FilePath.ToString() != string.Empty)
{
StringBuilder sb = new StringBuilder();
sb.Append("
sb.Append("codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,2,0 Width = " + Width.Value.ToString() + " Height = " + Height.Value.ToString() + " > ");
sb.Append(""> ");
sb.Append(" ");
sb.Append(" ");
sb.Append(" ");
sb.Append(");
sb.Append("pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash ");
sb.Append("Width = " + Width.Value.ToString() + " ");
sb.Append("Height = " + Height.Value.ToString() + " ");
sb.Append("bgcolor=#000000 ");
sb.Append("scale= showall>");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.Write(sb.ToString());
writer.RenderEndTag();
}
else
{
// if you want it say nothing, just blank out the message
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.Write("");
writer.RenderEndTag();
}
}
catch
{
// with no properties set, this will render "Custom Flash Control" in a
// a box on the page
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.Write("Custom Flash Control");
writer.RenderEndTag();
} // end try-catch
} // end RenderContents
#endregion
} // end class
} // end namespace