C#: Loading an embeded swf into an flash activex without a temporary file
My project requires that my final application be completely self contained in a single exe. I am already combining the executable and dlls using ILMerge (assmebly merge utility). I am hosting an flash active x control in a C# application and I have embedded the one swf i need to load into the flash control into the c# application as an embeded resource.
This question shows how to write the resource to a temporary file, but it is undesirable to create temporary files for my situation. This creates a problem because the active x control loadMovie method only accepts a string pointing to the file to be loaded.
My question is: Is it possible to dynamically load embeded swf resources into a flash active x control without creating a temporary file?
The solution i ended up using was to package all the required swf files into the library of a wrapper swf.
Then i set the movie property of the activex control to the wrapper swf, and set the embed flag on the activex control to true. This embeds that swf directly into the activex control. I dont ever do any loading in the C#, rather i just call the play() method on the active x control to initialize the swf file that has been embeded.
Basically if im embedding a resource, there is no need to do it in the C#, i can just embed it in the swf. I then did all my loading and unloading in the flash wrapper swf.
you can add the swf file to the resources then at runtinme read the file as an array of bytes the send it to this function
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(YourForm)); System.Byte data = (System.Byte)(resources.GetObject("FileName"));