Feeds:
Posts
Comments

Archive for the ‘Flash Player’ Category

 

~Mike

Advertisements

Read Full Post »

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

Read Full Post »

Clearing Visual Studio recent projects list

Clearing Flash 8 Recent Items list

Read Full Post »