Search code examples
flashactionscriptlocalconnection

What might cause connection errors when using bidirectional localConnection in Flash?


I'm trying to setup a bidirectional localConnection (LC) between two flash objects on the same web page. One object is AS2 and the other AS3.

  1. I'm using one LC object to send and receive data on each swf. (This shouldn't matter, right? I tried using two objects, one for sending and one for receiving, but got the same problem).

They .connect() properly so that they both listen. But I'm getting errors when I'm trying to send data from the AS2 SWF to the AS3 LC. This happens 95% of the time, but sometimes it DOES work, so I know it's not a problem with the LC names (I checked, obviously)

Sometimes one or two messages go through and consequtive messages fail.

Any idea on what might cause it?

I'm aiming to create a many-to-one connection map so that many AS2 swfs could connect to the one AS3 swf. Will that be a problem?


Solution

  • I finally figured out what caused the problem.

    It seems that although in AS3 you can use the same LC object to send AND receive events, doing so in AS2 will give you errors after a while (probably when trying to send after receiving).