Hello,
The problem is as follows, I have setup a local connection to comunicate with a AS2 swf inside a AS3 container. The problem is that there can be only one connection. If I open two tabs with the same page, in the second tab I will no longer be able to use the local connection.
Do you know any workaround? Or some kind of lc negotiation...
Thanks
Comments
Howdy, who's listening and who's sending ?! Is it bi-directional ?
You can have a try catch mechanism to try opening a localconnection with the name "lcname". If it fails, you try lcname1, if that also fails, you try lcname2 , and so on ... After you get a name tha succeeds, you send the number (or the whole lc name) to the AS2 app by flashvars (this means you load the AS2 after you open the AS3 LC). Then the AS2 app knows the LC name for AS3 and can also compose a similar name for it's LC name (like lcname2 <-> as2lcname2).
Very fast response... Thanks man.
Well, yes, is bi-directional. And I think the flashvars approach should solve my problem. I am concerned that, the container opens multiple children (although one at a time :) ) And when the next one openes, I could just send him, by flashvar the connection name.
I think this should work nice with a negotiating LC that generates on one side a random string, and they use it if it's free. This way we can have a unlimited number of LC's...
Thanks again.
One other thing, do you know any bug, related to Local Connection on IE? Some people say sometimes it's not working in IE even if it's the only browser window opened.
I know that FP for IE sometimes keeps the lc name open even after the application was closed and unfortunatelly that can only be fixed by a browser/system restart.
Make sure you call the close() method for each localconnection when it's not needed anymore.
Also, for the name, you might want to append the random name to something like your domain name so that it doesn't colide with other apps. LC names must be unique per computer, not per domain ... so if you generate a random lc22, it might be that some other app from who knows where already uses that lc22 ... so just to be safe, use mydomain_com_lc22, or something like that.