What is the best way to deal with local connection refresh between ASF and AS2 swfs using SWFBridge? (loading, unloading, loading again)
I have an AS2 swf that is hosted in swf AS3 and they connect using SWFBridge. In the course of things, I need to unload AS2 swf and reload it. So my guess is that I need to reconnect the SWFBridge. But when I try to reopen the connection it doesn't seem to work. This is 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
... over time
loader.unload(); // unload the AS2 swf
myBridge.close();
setUpBridge();
loadAS2SWF();
Can anyone see what I am doing wrong? Everything works fine for the first boot of AS2 swf, but no connection is established on subsequent loads ....
... by the way - it would seem that on reconnection, communication works fine from host to client, but function calls from clien to host swf are not coming? confusing!
thanks
------------------------------------- UPDATE --------- --- -------------------------------
I found that when I had 2 browser windows open SWFBridge did not work. There seems to be a problem with connections using the same ID. For a discussion of this and some workarounds, look for the "multiple connection problem" on the Grant Skinner blog
Hope it helps.
a source to share