Embedding Flash in a .Net form
Sunday, January 28th, 2007I’ve needed to do this various times and there’s always a few gotchas, here’s a brain dump for my own future reference if nothing else…
- In Visual Studio 2005 Express Edition, go to Tools -> Choose Toolbox Items
- From the “Com Components” panel tick “Shockwave Flash Object” then click OK.
- In the toolbar now, if you expand the “All Windows Forms” group and look at the end you should see a new “Shockwave Flash Object” entry that you can drag onto your form.
To load a swf into your object, either set the full path in the “Movie” parameter using the Properties panel at design time, or at runtime using something like…
this.axShockwaveFlash1.LoadMovie(0, "D:\\test.swf");
Note - in both cases the paths must be absolute or the movie wont load.
If you get the error…
“Failed to import the ActiveX control. Please ensure it is properly registered”
…with VS running you need to go into the \obj\debug folder under your project root and delete any file(s) in there with ‘interop’ in their name. New (working) files should be auto generated for you and the problem fixed.
I’ll add more tid-bits to this list as I find them…




