开发者

LocalConnection working in local browser but NOT in remote site

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 re开发者_如何学编程mote site, localConnection fails.

Anyone encounter this??


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


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");


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜