Embedding swf (Flash) file as a resource

Embedding swf (Flash) file as a resource

am 15.01.2008 11:26:00 von _AnonCoward

How do I embed a swf (flash) file as a resource in my custom web control?

And, if thats possible, how would I access it when I am (presumably)
overriding the RenderContents method?

Thanks in advance,
JJ

Re: Embedding swf (Flash) file as a resource

am 15.01.2008 12:33:09 von _AnonCoward

These are the steps I've tried:

1. Adding the 'myFlashFile.swf" to the web control project, and setting its
property as an embedded resource;

2. Adding the following line to the AssemblyInfo.cs file:

[assembly: System.Web.UI.WebResource("MyNamespace.myFlashFile.swf",
"application/x-shockwave-flash")]

3. Accessing the WebResource URL by way of this line in the RenderContents
method:

string flashUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(),
"MyNamespace.myFlashFile.swf").ToString();

A URL is produced, but one that is clearly not understood by the browser,
even though I write the url in the usual Flash Object Code.
Is it therefore possible to do this?




"JJ" wrote in message
news:ucTfIE2VIHA.2268@TK2MSFTNGP02.phx.gbl...
> How do I embed a swf (flash) file as a resource in my custom web control?
>
> And, if thats possible, how would I access it when I am (presumably)
> overriding the RenderContents method?
>
> Thanks in advance,
> JJ
>

Re: Embedding swf (Flash) file as a resource

am 16.01.2008 06:28:40 von wawang

Hi JJ,

I've created following test and it's working on my side:

1) ClassLibrary1.Class1:

[assembly: WebResourceAttribute("ClassLibrary1.flash1.swf",
"application/x-shockwave-flash")]

namespace ClassLibrary1
{
public class Class1 : WebControl
{
protected override void Render(HtmlTextWriter writer)
{
string template = @" CLASSID='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' WIDTH='400'
HEIGHT='320'
CODEBASE='http://active.macromedia.com/flash5/cabs/swflash.c ab#version=7,0,0
,0'>





wmode=transparent TYPE='application/x-shockwave-flash'
PLUGINSPAGE='http://www.macromedia.com/shockwave/download/in dex.cgi?P1_Prod_
Version=ShockwaveFlash'>

";
writer.Write(string.Format(template,
Page.ClientScript.GetWebResourceUrl(this.GetType(),
"ClassLibrary1.flash1.swf")));
}
}
}

2) Remember to add flash1.swf into the root folder of the class library and
configure its build action as "Embedded Resource"


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Re: Embedding swf (Flash) file as a resource

am 16.01.2008 12:45:17 von _AnonCoward

Thanks Walter. It must be another problem if it works on yours.....


""Walter Wang [MSFT]"" wrote in message
news:twaFyCAWIHA.4720@TK2MSFTNGHUB02.phx.gbl...
> Hi JJ,
>
> I've created following test and it's working on my side:
>
> 1) ClassLibrary1.Class1:
>
> [assembly: WebResourceAttribute("ClassLibrary1.flash1.swf",
> "application/x-shockwave-flash")]
>
> namespace ClassLibrary1
> {
> public class Class1 : WebControl
> {
> protected override void Render(HtmlTextWriter writer)
> {
> string template = @" > CLASSID='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' WIDTH='400'
> HEIGHT='320'
> CODEBASE='http://active.macromedia.com/flash5/cabs/swflash.c ab#version=7,0,0
> ,0'>
>
>
>
>
>
> > wmode=transparent TYPE='application/x-shockwave-flash'
> PLUGINSPAGE='http://www.macromedia.com/shockwave/download/in dex.cgi?P1_Prod_
> Version=ShockwaveFlash'>
>
> ";
> writer.Write(string.Format(template,
> Page.ClientScript.GetWebResourceUrl(this.GetType(),
> "ClassLibrary1.flash1.swf")));
> }
> }
> }
>
> 2) Remember to add flash1.swf into the root folder of the class library
> and
> configure its build action as "Embedded Resource"
>
>
> Regards,
> Walter Wang (wawang@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>