Is there a good way to add a .swf programatically to a panel on an asp.net page - ie: I know i could just insert the html tags:
ie:
<object type="application/x-shockwave-flash" data="yourflash.swf" width="" height="">
<param name="movie" value="yourflash.swf">
</object>
But is there an existing .net or free FLASH component already that you just set the properties on, or do i need to create a custom web control myself (not preferred) so i dont have to continously do this?
Thank you.
FlashObject.cs
:
namespace MyNamespace
{
using System.Web.UI;
public class FlashObject : Control
{ public int Width {get;set}
public int Height {get;set}
[UrlProperty] pubic string SourceUrl {get;set;}
protected override Render(HtmlWriter writer)
{ writer.WriteLine( "<object type='application/x-shockwave-flash' "
+" data='{0}' width='{1}' height='{2}'>\r\n"
+" <param name='movie' value='{0}'>\r\n</object>"
,ResolveUrl(SourceUrl)
,Width
,Height);
}
}
}
Web.config
:
<system.web>
<controls>
<add tagPrefix="my" namespace="MyNamespace" assembly="MyAssembly" />
</controls>
</system.web>
MyPage.aspx
:
<my:FlashObject SourceUrl='~/yourflash.swf' runat='server' />
Do like above but instead of emmiting the object and embed code, include swfobject http://code.google.com/p/swfobject/ and emit some nice unintrusive javascript into your page to insert the swf!