title: What is the best way to handle refreshing a localConnection between AS3 and AS2 swfs using SWFBridge? (load, unload, load again)
body: <p>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 - </p>
  
  <p><strong>AS3 Code:</strong></p>
  
  <pre><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
  </code></pre>
  
  <p><em>... sometime later</em></p>
  
  <pre><code>loader.unload(); // unload the AS2 swf
  myBridge.close();
  setUpBridge();
  loadAS2SWF();
  </code></pre>
  
  <p>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....</p>
  
  <p>... 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!</p>
  
  <p>Thanks</p>
  
  <p>------------------------------------- UPDATE -------------------------------------------</p>
  
  <p>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 <a href="http://www.gskinner.com/blog/archives/2007/07/swfbridge_easie.html" rel="nofollow noreferrer">blog</a></p>
  
  <p>Hope this helps.</p>