We help IT Professionals succeed at work.
Get Started

Need VB6/Flash 8+ bi-directional communication

Last Modified: 2013-11-25
I need to add a Flash component to an existing VB6 app.  I've embedded the Shockwave Flash component into a form, loaded it (with both LoadMovie and Movie), and am getting a response from the .swf in the _FlashCall event.  However, I'm not able to do the following:

1. Respond to the _FlashCall event.  I can't seem to get the syntax right on the SetReturnValue call.  The .swf is calling "isReady" and expects a value of true to be returned.  

2. I'm setting FlashVars but when I look at it, FlashVars is empty.  How do I set FlashVars?

A sample of the code is provided here.

StreamViewer is the name of the Shockwave Flash objject in the form.

Public Sub streamRtmp(myRtmpPath As String, myRtmpSession As String)
    rtmpPath = myRtmpPath
    rtmpSession = myRtmpSession
    'Call StreamViewer.LoadMovie(0, strExe & "\streamViewer.swf")
    StreamViewer.Movie = "file://" & strExe & "\streamViewer.swf"
    StreamViewer.FlashVars = "appUrl:'" & rtmpPath & "',streamId:'" & rtmpSession & "',scale:'showAll'"
    ' Looking at StreamViewer.FlashVars here shows it's empty
End Sub

Private Sub StreamViewer_FlashCall(ByVal request As String)
    Dim reqXml As New DOMDocument
    Dim sAry() As String
    reqXml.loadXML request
    Dim elem As IXMLDOMElement
    Set elem = reqXml.selectSingleNode("invoke")
    Dim funcName As String
    funcName = elem.getAttribute("name")
    Dim ret As String
    Select Case funcName
        Case "isReady"    ' This comes from the .swf looking for a true return value
            Dim s =  "<invoke name='isReady' returntype='xml'><arguments><true/></arguments></invoke>"
            Call StreamViewer.SetReturnValue(s)
    End Select
End Sub

I've also tried returning ...<arguments><boolean>true</boolean></arguments>... and many other variations.

In the .swf ActionScript 3:

private function isContainerReady():Boolean {
    var result:Boolean = ExternalInterface.call("isReady");
    return result;

Any working example would be great that has VB6 responding to an ExternalInterface call from Flash 8+ (ActionScript 3) and has VB loading FlashVars into the swf.
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE