I have an AS2 swf that is hosted by an AS3 swf and they connect using SWFBridge. During the course of things i need to unload the AS2 swf and reload it. Therefore I assume I need to re-establish the SWFBridge connection. But when I try to reopen the connection it doesnt appear to work. Heres what I have -
AS3 Code:
var myBridge:SWFBridgeAS3;
function setUpBridge() :void {
myBridge = new SWFBridgeAS3("connectionID", this);
myBridge.addEventListener(Event.CONNECT, handleConnect);
}
setUpBridge(); // the first time
loadAS2SWF(); // loads the As2 swf using Loader class
... sometime later
loader.unload(); // unload the AS2 swf
myBridge.close();
setUpBridge();
loadAS2SWF();
Can anyone see what I'm doing wrong? Everything works fine for the first load of the AS2 swf but the connection is not being established in subsequent loads....
... incidentally - it would appear that when reconnecting, the communication works ok from the host to the client but no calls to functions from clien to host swf are received?? confusing!
Thanks
------------------------------------- UPDATE -------------------------------------------
I found that when I had 2 browser windows open SWFBridge would not work. It seems there is an issue with connections using the same ID. For a discussion of this and some workarounds search for 'multiple-connection issue' on Grant Skinner's blog
Hope this helps.