1. Create a new VB project.

2. Add the Shockwave Flash ActiveX control to your project. Create an instance of the control in your form.

3. Name the control "flashmov".

4. Open the code window for your form (i.e the Form_Load event), and add the following code:

'movie.swf is movie file 
flashmov.Movie = App.Path & "movie.swf"

Note that the above code assumes that the movie is in the same file as the vb project.

5. You can call vb function from flash by using fscommand.

For example, you can create a button in flash and insert the action:

//the below code is for flash not for vb 

6. Create the swf file.

7. The vb code that responds to the Flash command is:

Private Sub flashmov_FSCommand(ByVal command As String,  
ByVal args As String)
If command = "execute" then  
MsgBox "Hey i can control vb"
End Sub

8. The code displays a messagebox when you press the Flash button.

Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and sitepoint.com cemented her lasting interest in the media, persuasion, and communications culture.

No Reader comments

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.