Does anyone know if there are any tricks to having two AIR applications
(captive runtime) on the same computer talk to each other via LocalConnection?
Receiver;
private var _lcReceiveConnection:LocalConnection = new LocalConnection();
public function startLocalReceiveListener():void
{
_lcReceiveConnection.allowInsecureDomain("*");
_lcReceiveConnection.allowDomain("*");
_lcReceiveConnection.addEventListener(StatusEvent.STATUS,receiveLocalStatus);
_lcReceiveConnection.client = this;
try
{
Alert.show("_lcReceiveConnection connecting-" + _strApplicationID,"Listening");
_lcReceiveConnection.connect("TestSend");
// _lcReceiveConnection.connect(_strApplicationID);
}
catch(err:Error)
{
Alert.show("err.message" + err.message,"startLocalReceiveListener");
}
}
private function receiveLocalStatus(event:StatusEvent):void
{
Alert.show(event.level,"receiveLocalStatus");
}
public function receiveLocalMessage(strMessage:String):void
{
Alert.show(strMessage,"receiveLocalMessage");
}
Sender;
private function getNextApplication(strApplcationID:String):void
{
txtOutput.text += "Checking If " + strApplcationID + " is open.";
_strCurrentApplcationID = strApplcationID;
_lcSendConnection.allowInsecureDomain("*");
_lcSendConnection.allowDomain("*");
_lcSendConnection.addEventListener(StatusEvent.STATUS, sendLocalStatus);
trace("Sending to:" + strApplcationID);
_lcSendConnection.send("TestSend","receiveLocalMessage","Are you there?");
//
_lcSendConnection.send(strApplcationID,"receiveLocalMessage","Are you there?");
}
private function sendLocalStatus(event:StatusEvent):void
{
_lcSendConnection.removeEventListener(StatusEvent.STATUS, sendLocalStatus);
txtOutput.text += "Message to " + _strCurrentApplcationID + " reports " +
event.level;
Sender status event.level is always "error." and the message never gets to the
Receiver.
Paul R. Stearns
Advanced Consulting Enterprises, Inc.
15280 NW 79th Ct.
Suite 250
Miami Lakes, Fl 33016
Voice: (305)623-0360 x107
Fax: (305)623-4588