473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Embedding swf (Flash) file as a resource

JJ
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
Jan 15 '08 #1
3 3725
JJ
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" <ab*@xyz.comwrote in message
news:uc**************@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

Jan 15 '08 #2
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 = @"<OBJECT
CLASSID='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' WIDTH='400'
HEIGHT='320'
CODEBASE='http://active.macromedia.com/flash5/cabs/swflash.cab#version=7,0,0
,0'>
<PARAM NAME=movie VALUE='{0}'>
<PARAM NAME=play VALUE=true>
<PARAM NAME=loop VALUE=false>
<PARAM NAME=wmode VALUE=transparent>
<PARAM NAME=quality VALUE=low>
<EMBED SRC='temp.swf' WIDTH=400 HEIGHT=320 quality=low loop=false
wmode=transparent TYPE='application/x-shockwave-flash'
PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash'>
</EMBED>
</OBJECT>";
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 (wa****@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.

Jan 16 '08 #3
JJ
Thanks Walter. It must be another problem if it works on yours.....
""Walter Wang [MSFT]"" <wa****@online.microsoft.comwrote in message
news:tw**************@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 = @"<OBJECT
CLASSID='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' WIDTH='400'
HEIGHT='320'
CODEBASE='http://active.macromedia.com/flash5/cabs/swflash.cab#version=7,0,0
,0'>
<PARAM NAME=movie VALUE='{0}'>
<PARAM NAME=play VALUE=true>
<PARAM NAME=loop VALUE=false>
<PARAM NAME=wmode VALUE=transparent>
<PARAM NAME=quality VALUE=low>
<EMBED SRC='temp.swf' WIDTH=400 HEIGHT=320 quality=low loop=false
wmode=transparent TYPE='application/x-shockwave-flash'
PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash'>
</EMBED>
</OBJECT>";
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 (wa****@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.

Jan 16 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: amit | last post by:
Hello, I am currently studying how to embedd python. I am developing a graphical C++ application. My goal is to embedd python script that will control some kind of animation. I have some...
0
by: MikeY | last post by:
With Reference/Resource is there a way of embedding the .resource file within a folder of my application instead of having it in the main project /executing assembly area. i.e. if I have a folder...
3
by: UJ | last post by:
I've got an image I want to embed in a dll to use on a screen later. I've got it in a resource file, got it to compile in to the dll. The problem is getting it back out. It seems like my problem is...
1
by: Jon Paal | last post by:
trying to embed a text file as a resource when compiling with vbc.exe /resource: "readme.txt" error returned is asking for <resinfo> what is "<resinfo" and what is correct command line...
3
by: Buggyman | last post by:
Hi, I have been given a swf file to embed as a banner on our site... Does anyone have any tips on how I do this?? -- *Many* thanks. :)
3
by: Ollie Riches | last post by:
How do I embed a *.flv file (Flash Video) into an aspx page similar to embedding windows media player active x control? Cheers Ollie Riches
3
by: fnustle | last post by:
I've embedded a flash file into an assembly: But when I try to reference it on a web page: <object codebase="http://download.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab"...
1
by: Chris72205 | last post by:
How would I go about embeding a flash application into an HTML page? Note that I say flash application, it's not just the average .swf file. How do I embed that or is it possible? I am familiar...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.