2

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?

Community
  • 1
  • 1
JohnU
  • 201
  • 2
  • 9
  • You've mentioned 'loadMovie' which means you're using actionscript 2. If you were using actionscript 3 you could just embed the swf to be loaded into the main swf using the Embed tag that mxmlc, the compiler know how to deal with. I might be possible to create an URLLoader or an URLStream, set it's header to accept binary data and tell c# to send the swf bytes. when that would be complete, you would create a Loader object and feed bytes using loadBytes, thus converting the bytearray to a DisplayObject. does this make sense ? – George Profenza Aug 30 '09 at 14:42
  • The loadMovie method is a C# method on the flash active x control. – JohnU Sep 01 '09 at 06:02

2 Answers2

1

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.

JohnU
  • 201
  • 2
  • 9
1

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"));
Community
  • 1
  • 1
ahmedsafan86
  • 1,776
  • 1
  • 26
  • 49