Question

I have a Flash CS4 AS3 swf (host) that loads a Flash 8 AS2 swf (client) using gSkinner's swfBridge.

This works great and the Host can call functions in the client no problem. However I want to be able to call a function in the client and have that function return an array to the host.

This is the code I thought would work -

Host (AS3) code -

var hostArray:Array = new Array();
hostArray = mySwfBridge.send("getArray");

Client (AS2) code

var theArray = new Array("item1, item2, item3);
function getArray() :Array {
    return theArray;
}

any ideas?

Was it helpful?

Solution

The problem your exposed towards is that the LocalConnection (used by SwfBridge) does it calls asynchronously. In other words, the execution of the caller script won't halt its execution to await a result back from the invoked function.

If you need to retrieve a value from the other side of the LocalConnection you need to set it up to work bidirectionally. i.e. your client script must send its result back to a callback method on the host object via LocalConnection (SwfBridge in this case) instead of doing this via return.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top