views:

275

answers:

3

Really puzzled by the flaky behavior of LocalConnection. Using a debug utility(LuminicBox) that uses localConnection to work.

When the page containing the swf is loaded in a browser locally , localConnection works.

When the identical page and swf are viewed 'live' on a remote site, localConnection fails.

Anyone encounter this??

A: 

By default LocalConnection allows communication between swfs loaded from the same domain. When you're loading the swf in the browser, the debug utility also has to be loaded in the browser from the same domain.

You can get LocalConnection to work across domains but it requires more configuration. Here's a link to Flex's docs on the subject. This issue is the same for Flash/Flex.

http://livedocs.adobe.com/flex/3/langref/flash/net/LocalConnection.html

Sam
thats it. Embedded the debug swf in the same page as my application.
eco_bach
A: 

I haven't used LuminicBox, but if you have access to the code that initializes the receiving LocalConnection object, call allowDomain("your.domain") on that object.

var lc:LocalConnection = new LocalConnection()
lc.allowDomain("your.domain.com");
//or even better - allow all domains
lc.allowDomain("*");

If the receiving SWF is hosted on an HTTPS page and the sender on a normal page, you need to call allowInsecureDomain.

lc.allowInsecureDomain("your.domain.com");
Amarghosh
A: 

I think part of the problem is that I DON"T have access to the code that initializes the receiving LocalConnection object, just the sending LC (my application).

I would assume though, that the author of the debug utility would have definitely used lc.allowDomain("*"); Will check further.

The only other cause I am aware of is having an existing LC connection already open, when you try and open a new one.

eco_bach