Friday, January 16, 2009

VB.NET Tutorial: Integrating Flash In Your Application


Click the link to download the source code for this post

Licensing and Warranty

You may use the code as you wish - it may be used in commercial or other applications, and it may be redistributed and modified. The code is provided "as-is". No claim of suitability, guarantee, or any warranty whatsoever is provided. By downloading the code, you agree to defend, indemnify, and hold harmless the Author and the Publisher from and against any claims, suits, losses, damages, liabilities, costs, and expenses (including reasonable legal or attorneys' fees) resulting from or relating to any use of the code by you.




Overview


You may have a situation where you want to or need to integrate a Flash film (swf) in your application for a variety of reasons. You can easily do this in Visual Basic .NET using the Shockwave Flash Object. I have created an illustration of integrating Flash and VB.NET by creating a very simple flash player written in VB.Net

You can download the sample code from the link that appears at the top of this post. Note that you may have to modify the code to your environment. If you want to see a demonstration of this application, view the video below:

4 comments:

Rafay Bin Ali said...

Great idea to create superb animations real quick for WinForms. One quick question: Why does it not BUILD (get built?) the first time in VS 2005?

Jennifer said...

Excellent question, Rafay!

Honestly, I'm not sure why it doesn't build the first time in VS 2005. If you do this same exercise in VS 2008, the control gets added to the form without having to rebuild the application.

Hopefully one of the readers may have some insight.

Anonymous said...

Heres something that I found that may answer Rafay's question. Some guy posted it on a Microsoft forum:

"The reason that my ActiveX contol (and possibly other ActiveX controls from other parties, excluding some 'very simple' controls) was not insertable on a Visual Studio 2005 .Net Windows Form directly was because of 2005, and unlike its predecessor VS2003, does not automatically add the necessary and needed COM reference to the OLE Automation type library - stdole.tlb or stdole2.tlb."

Jennifer said...

Nice find, big fan of Bill Gates!

I also found this article on MSDN - http://msdn.microsoft.com/en-us/library/ms364063(vs.80).aspx. Perhaps it may also have to do with how the control is compiled.