Flash Script – Controlling Visual Basic From Flash

By Georgina Laidlaw

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.

No Reader comments

Get the latest in Front-end, once a week, for free.