473,803 Members | 3,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SWF as embedded resource and .NET

I know the question of whether or not a SWF file can be read in by a
..NET application has been asked a billion times, however, what I'm
asking is whether or not it is possible (any examples? tutorials? Flash
Object COM readme?) to embed a SWF file into your VS.NET project as a
resource, and then read in the file into the Flash object much the same
way that you currently do using the LoadMovie function that takes in a
layer and a file location path.

Anyone know of a way to load a SWF that is an embedded resource and not
in the physical directory path into a .NET application?

Thanks all
-Steve

Feb 14 '06 #1
1 2966
Hi,

<ph*******@comc ast.net> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I know the question of whether or not a SWF file can be read in by a
.NET application has been asked a billion times, however, what I'm
asking is whether or not it is possible (any examples? tutorials? Flash
Object COM readme?) to embed a SWF file into your VS.NET project as a
resource, and then read in the file into the Flash object much the same
way that you currently do using the LoadMovie function that takes in a
layer and a file location path.

Anyone know of a way to load a SWF that is an embedded resource and not
in the physical directory path into a .NET application?


AFAIK you can insert any file as a resource, you later would have to
"de-embed" it in a temp file and feed this file to the flash player.

With the code below you check the resources for the expected name, save it
to a temp file and return the pathof the new file
Note that the original extension is also kept

static string ExtractResource ( string resourceName)
{
//look for the resource name
foreach( string currentResource in
System.Reflecti on.Assembly.Get ExecutingAssemb ly().GetManifes tResourceNames( )
)
if ( currentResource .LastIndexOf( resourceName) != -1 )
{
string fqnTempFile = System.IO.Path. GetTempFileName ();
string path = System.IO.Path. GetDirectoryNam e( fqnTempFile);
string rootName= System.IO.Path. GetFileNameWith outExtension(
fqnTempFile);
string destFile = path + @"\" + rootName + "." +
System.IO.Path. GetExtension( currentResource );

System.IO.Strea m fs =
System.Reflecti on.Assembly.Get ExecutingAssemb ly().GetManifes tResourceStream (
currentResource );

byte[] buff = new byte[ fs.Length ];
fs.Read( buff, 0, (int)fs.Length) ;
fs.Close();

System.IO.FileS tream destStream = new System.IO.FileS tream ( destFile,
FileMode.Create );
destStream.Writ e( buff, 0, buff.Length);
destStream.Clos e();

return destFile;
}

throw new Exception("Reso urce not found : " + resourceName);

}
Feb 15 '06 #2

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

Similar topics

1
24180
by: james | last post by:
What class / method should I be using to get the full path to an embedded resource ? In my case I have an .xml file that my app uses, it is set as embedded resource, and I have a control that needs to load it, but I do not want to hard code the path since that may change for different installs. i.e. GetPathForResourceOfName ( myResourceFileName ) thanks, JIM
5
8232
by: Drew | last post by:
Assembly asm = Assembly.GetExecutingAssembly(); me = new Bitmap(asm.GetManifestResourceStream("me.gif")); I have used this before without any problem, but now I get: An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: 'null' is not a valid value for 'stream'.
1
2955
by: n! | last post by:
I have an irritating problem with VS.NET2003, C#. I wrote some code that would build my application menu from an XML resource file. Purely to make it easy for me to edit, so I've added this file as an embedded resource. My irritation, is that when I update the resource file and nothing else. VS does not build the project with the newly edited resource file. So if I run the application again, it actually hasn't been updated to use my newly...
2
1895
by: Kyle Kaitan | last post by:
I have an assembly (AppResources.dll) which contains a number of embedded resource files. Most of these are key/value pairs of relevant strings; a few are images and sounds; some more are XML files. My application will load the resources into memory as they are needed. I would like to be able to read and write to these embedded resources. Is it possible to write to an embedded resource within an assembly? If so, how? If it's not...
0
1639
by: ATS | last post by:
HOWTO Make a UserControl deploy an embedded resource. Please help, I need to embed an EXE into a C# UserControl that is run from script in an HTML web page as such: <html> <object id=objTest
0
2203
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have multiple web forms. When you compile the application, it creates a DLL. If you view this DLL using ILDASM (the manifest), it shows info about the resources stored in the DLL. There is essentially an embedded resource "section" for each web form. The...
4
4430
by: Jason Pettys | last post by:
In an ASP.NET project I am setting the content type of my .ascx and ..aspx files to Embedded Resource for a separate reason. When I do this they get embedded as "RootNamespace.Filename" but I would like them to be embedded as "RootNamespace.Folder.Filename". I see that the .resources files are embedded with the containing folder information in the namespace, and I think c# projects work this way, too. Is there any way (a vbc command...
3
9818
by: raghu sunkara | last post by:
Hi, How Can i Change or Modify Embedded String Resource In An Assembly. I Need To Modify Embedded String Resource In An Assembly. Please Help Me. Thanks Raghu.
2
2421
Frinavale
by: Frinavale | last post by:
I am attempting to use embedded resources in an Ajax Enabled ASP.NET Web Application. I'm using Visual Studio 2008 and VB.NET server side code. The project is called "EmbeddedResources" with the namespace "EmbeddedResources" My resources are not included when the content is rendered in the browser. I have marked my JavaScript resource as Embedded. I am able to retrieve the path to the resource from the WebResource.axd HTTP Handler during...
2
8728
by: steve | last post by:
I have the following routine for retrieving error message strigs from a resource file which is embedded in the project. But when it is called I get the error messsage "Could not find any resources.." shown underneath the code. The error message indicates that it is looking for resource ResourceExceptions.resource which is not what was embedded in the code by Visual Studio. The resource file is ResourceExceptions.resx. If I try to change...
0
9700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9121
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.