C#: Loading an embeded swf into an flash activex without a temporary file

泄露秘密 提交于 2019-12-07 19:01:15

问题


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?


回答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.




回答2:


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"));


来源:https://stackoverflow.com/questions/1310719/c-loading-an-embeded-swf-into-an-flash-activex-without-a-temporary-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!