SharpStyle Labs

Creativity is coming up with new things. Innovation is doing new things. We make software that helps you do both.

  • Pages

  • a

  • Archives

Flash OCX control and Visual Studio 2005 issues

Posted by sharpstyle on March 28, 2007

Cross posted here SharpStyle Neutron blog.

As I was preparing for tutorial of using SharpStyle Neutron to develop an ActionScript project and Windows Forms within one solution, I ran into the following issue: while there are a number of references on the web on how to use Flash OCX within Visual Studio 2003, there are only a handful of results related to Visual Studio 2005 and most of them document the problems that people are having.

Following the steps from this article (Macromedia – Developer Center Embedding Macromedia Flash Player in a C# Application) produce the following errors:

  • There is a popup stating that VS ”Failed to import the ActiveX control.  Please ensure it is properly registered
  • If you examine Error List, under Warnings, you will see the following

Could not resolve dependent COM reference “stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.  

Failed to create the wrapper assembly for type library “AxShockwaveFlashObjects”. Exception of type ‘Microsoft.Build.Tasks.ComReferenceResolutionException’ was thrown.

The referenced component ‘AxShockwaveFlashObjects’ could not be found. Failed to create the wrapper assembly for type library “AxShockwaveFlashObjects”. Exception of type ‘Microsoft.Build.Tasks.ComReferenceResolutionException’ was thrown. 

I found the following Unable to add Flash 8 control in VS2005 – Tentative workaround blog post from 2005-12-07, but the instructions there didn’t work. After doing a few more searches I found the following forum page in French (translated page / original page)

Here is what needs to be done:

  • Open Visual Studio 2005 command prompt and execute the following:
    • aximp.exe – source “C:\WINDOWS\system32\Macromed\Flash\Flash9b.ocx”
  • This will generate the following files. Items in bold are the important ones:
    • AxShockwaveFlashObjects.dll
    • AxShockwaveFlashObjects.pdb
    • ShockwaveFlashObjects.dll
    • AxShockwaveFlashObjects.cs

  • In Visual Studio, add the references to the 2 dlls generated by aximp (I copied them from “C:\Program FIles\Microsoft Visual Studio 8\VC” to the root of the project): 

  • Add namespaces to the imports section

using AxShockwaveFlashObjects;
using ShockwaveFlashObjects;

  • And here is some sample code to display SWF
AxShockwaveFlash axShockwaveFlash = new AxShockwaveFlash();
axShockwaveFlash.Location = new System.Drawing.Point(50, 50);

this.Controls.Add (axShockwaveFlash);
//this.Show(); // Avoids InvalidActiveXStateException.

axShockwaveFlash.Movie = "D:\\test.swf";
//* it is important to set Size after specifying Movie property
//* if Size is specified before, it is ignored
axShockwaveFlash.Size = new System.Drawing.Size(20, 20);
axShockwaveFlash.Play();
 
References:

~Mike


17 Responses to “Flash OCX control and Visual Studio 2005 issues”

  1. gary said

    I’m doing a site redesign at the moment and I am trying to get started with flash/ asp integration. Could i get the source code for this example? I know it is simple, but I am a bit stuck and I think it would really help me to get started.

    Thanks
    Gary

  2. sharpstyle said

    Hello Gary,

    As you are interested in website development, combining ASP/ASP.NET with Flash, you might be interested in this tutorial: Tutorial — ActionScript and Web Application Solution (ActionScript 2)

    ~Mike

  3. Thabo said

    Hey there, thanx alot! Your blog helped!

  4. sharpstyle said

    Thanks for letting us know.

  5. Jason Maskell said

    This helped a lot, thanks. :)

  6. Riya said

    :( |)
    this is quite informatic…..

  7. vidhi said

    aximp commmand is giving an error:AxImp Error: Access is denied. (Exception from HRESULT: 0×80070005 (E_ACCESSDENI
    ED)).plz help

  8. sharpstyle said

    We haven’t run into this. A few things to check:
    + does OCX exist?
    + is OCX read-only?
    + do you have permissions on the directories?

    let us know

  9. Arvind said

    Thanks a -LOT- for this information. I was just about to give up in frustration when I saw your article. It worked like a charm, even with the latest ocx from Adobe. Keep up the great work!

  10. sharpstyle said

    Thank you.

  11. GreyStork said

    In cases where other components haven’t already done so, you will likely need to add the standard OLE library. You can do so by adding a reference to the COM library ‘OLE Automation’, normally located at ‘C:\Windows\System32\stdole2.tlb’.

  12. ~V~ said

    Hi

    I followed all steps given here but still facing same problem
    I can’t add AxShockFlashPlayer Object to my form it gives error that it is not properly registred….

    Please Help

  13. Mikesquallmx said

    Actually I’m working with VB 2005 and I have problems in design time when I tried to use the Flash9f.ocx in a form. when I tried to put the ocxObject in the form, it appearsme the same massage box tha says: Could not resolves references form. I tried whith your method, but nothing in design time.

  14. Mikesquallmx said

    Note: Sorry, I forgot, my project is a desktop project.

  15. diro said

    Hello. I’ve tried to do:

    axShockWaveObject = new AxShockwaveFlash();
    axShockWaveObject.Movie = “path to some movie”;
    axShockWaveObject.Play();
    //So far everything it’s fine but…

    axShockWaveObject.Stop(); //Doesn’t work. I mean, it //doesn’t stop de .swf

    Does anybody knows why?

    Please answer

  16. GUAN said

    I traced the message,”axShockwaveFlash.playing = fasle” when the flash is playing,what’s the matter? And I cannot control the “axShockwaveFlash” with “Stop()” or “PlayStop()”.

  17. Jatender said

    I have the same problem as GUAN stated

    ”axShockwaveFlash.playing = fasle” when the flash is playing,what’s the matter?

    Please help me to solve this issue.
    actually i want to know how can we detect flash clip finish playing in “axShockwaveFlash” control.so that we can run another clip.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>