I\'m pretty sure that this can be answered somewhere here on stackOverflow but I\'m out of options with this.
I have a VisualBasic form with an button object on it.
The way to do this is using the ExternalInterface class in AS3. It allows data to be passed between AS3 and the host application/container (be that a webpage or a VB Form etc).
In the AS3 side, you set it up as follows:
function myAS3Function(someNumber:Number, someObject:Object)
{
//do something with your number and object
trace(someObject.isAwesome);
return "hello from AS3";
}
//register your function with a label VB can call/invoke
if (ExternalInterface.available){
ExternalInterface.addCallback("myAS3Function", myAS3Function);
}
From the host side, you send/recieve XML to the ActiveX object.
Your XML looks like this:
<invoke name="myAS3Function" returntype="xml">
<arguments>
<number>5</number>
<object>
<property id="foo"><string>bar</string></property>
<property id="isAwesome"><true/></property>
</object>
</arguments>
</invoke>
Now, construct that XML in VB, and invoke the CallFunction
method of the VB flash object, passing it the xml string.
Dim returnValue As String
returnValue = MyFlashShockWaveObj.CallFunction(xml)
MsgBox(returnValue) 'hello from flash
If you are passing a lot of objects, sometimes it easiest to just JSON.stringify them and pass just one JSON string over to AS3 (and/or back).