C# – How to play a .swf file?

I am making a small research to convert a .swf file to an .exe file. I intend to build an .exe file with its resources which are .swf files. I will use this .exe file as a template later and just replace the resources with the .swf file which I want to convert. During the development I discover that I had a problem which I still did not solve. I could never load a .swf file in my application before. There are always problem when I tried to use the OCX control provided by Adobe.

Error loading ocx control
It happens always with Visual Studio 2005 at my computer although I registered it and re-registered it many times. I think there is a conflict between the version of .ocx control which I use and the version which VS 2005 expects. So today I tried with Visual Studio 2008 with the hope that it will work. So I do as following to insert a flash player to my application.

1. Right click on Toolbox window –> Choose Items…
Toolbox - Choose Items
2. Wait for a moment. On new window, click on Tab “COM Components” –> Shockwave Flash Object –> Click OK.

COM Component - Shockwave Flash Object

3. If it was successful, you would see the object Shockwave Flash Object on the Toolbox windows.

Shockwave Flash Object

4. Drag and Drop this component on Form.

Component on Form

5. Rename the control to chartFlashPlayer .Add this code to Form_Load event.

private void Form1_Load(object sender, EventArgs e)
chartFlashPlayer.LoadMovie(0, "D:\\fmared.swf");

6. Run form and I get it run. Ju hu.
Load successfully

I know this post may contain nothing helpful but anyways it’s first time that I can load .swf file in my application my computer at home. I feel happy. In next step I will try to load .swf file from resources and create a program to change the resource section so that I can replace with the file which I want. I hope everything will run smoothly. For more detailed instructions, you can follow this link http://www.adobe.com/devnet/flash/articles/stock_history.html


  1. Hello,
    I can’t find the Shockwave flash object under my COM objects? I’m using VS2005. Can any one please help me?.

  2. Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)

    I am getting this exception.Please help.

  3. Dear all,

    I install a flash player and add shockwaveflashobject in my tools. I have another problem.
    when I run the application file form ….bindebugmyPrj.exe it run correctly. But when I move myPrj.exe file into the other folder (for example Desktop), an error occurred. I get this error :

    Could not load file or assembly ‘AxInterop.ShockwaveFlashObjects, Version=, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.”:”AxInterop.ShockwaveFlashObjects, Version=, Culture=neutral, PublicKeyToken=null

    Is there anyone who how can I fix this problem?
    thanks in advance

Leave a comment

Your email address will not be published. Required fields are marked *