Insert flash animation (swf file) in Visual Basic

How to insert flash animation (swf file) in visual basic

Flash animation can be created in animation software just like Adobe Flash and SwishMax. The output of your animation is in .swf. Now the question is how are we going to embed that flash animation in our visual basic form?

Here are the step by step procedures on inserting swf file in your visual basic project.

1. Open your Visual Basic 6 program and select Standard exe.
2. Select Project in the menu bar and select Components.
3. Components Dialog box will appear, just like the image below. Now scroll down and check Shockwave Flash and click OK.

4. In your toolbox there is a paper like icon, that’s the Shockwave Flash component that you have added. Drag it to your form and set your desired height and width.

toolbox

5. Now add this code to your form.

ShockwaveFlash1.Movie = App.Path & “\ animation.swf”

In this example I have inserted the code above in the Load event of the form:

Private Sub Form_Load()
ShockwaveFlash1.Movie = App.Path & "\animation.swf"
End Sub

Where: animation.swf is the filename of your flash animation.

Note: in the example above, the animation.swf and the vb project (.vbp) should be on the same directory.

6. Press F5 to test your project.

, , , ,

Post navigation

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.