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 
fscommand("execute");

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.

Get your free chapter of Level Up Your Web Apps with Go

Get a free chapter of Level Up Your Web Apps with Go, plus updates and exclusive offers from SitePoint.


No Reader comments

Related books & courses
Available now on SitePoint Premium

Preview for $1