code_junkie

Whats the best way to programatically add a .swf to an asp.net page?

Nov 11th, 2011
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <object type="application/x-shockwave-flash" data="yourflash.swf" width="" height="">
  2. <param name="movie" value="yourflash.swf">
  3. </object>
  4.  
  5. namespace MyNamespace
  6. {
  7. using System.Web.UI;
  8.  
  9. public class FlashObject : Control
  10. { public int Width {get;set}
  11. public int Height {get;set}
  12. [UrlProperty] pubic string SourceUrl {get;set;}
  13.  
  14. protected override Render(HtmlWriter writer)
  15. { writer.WriteLine( "<object type='application/x-shockwave-flash' "
  16. +" data='{0}' width='{1}' height='{2}'>rn"
  17. +" <param name='movie' value='{0}'>rn</object>"
  18. ,ResolveUrl(SourceUrl)
  19. ,Width
  20. ,Height);
  21. }
  22. }
  23. }
  24.  
  25. <system.web>
  26. <controls>
  27. <add tagPrefix="my" namespace="MyNamespace" assembly="MyAssembly" />
  28. </controls>
  29. </system.web>
  30.  
  31. <my:FlashObject SourceUrl='~/yourflash.swf' runat='server' />
Add Comment
Please, Sign In to add comment