There is a security context that runs between Air applications that you
need to make happy. Air expects to share a security token between caller
and callee in order to accept the transport.

 

As a fast-track, I would explore Arthropod to see their discussion of
security integration between Air and their debugging Air app.

 

http://arthropod.stopp.se/

 

K 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of luvfotography
Sent: Thursday, February 05, 2009 12:05 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] localConnection not working from Air to Air

 

Any hints on getting a localConnection to work from AIR to AIR?
It works from FLEX to FLEX, I am using the code from the livedocs
example. I am getting a statusEvent of 'error'.
thanks,


<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" 


creationComplete="initConn()"
backgroundAlpha="0" backgroundColor="#FFFFFF">
<mx:Script>
<![CDATA[
import flash.net.LocalConnection;

private var conn:LocalConnection;

private function initConn():void{
btnSend.addEventListener(MouseEvent.CLICK, sendMessage);
conn = new LocalConnection();
conn.allowDomain('*');
conn.addEventListener(StatusEvent.STATUS, onStatus);
}

private function sendMessage(event:MouseEvent):void {
conn.send("localConn", "localconnectionHandler", inputTask.text);
}

private function onStatus(event:StatusEvent):void {
switch (event.level) {
case "status":
labelStatus.text = "LocalConnection.send() succeeded";
break;
case "error":
labelStatus.text = "LocalConnection.send() failed";
break;
}
}
]]>
</mx:Script>
<mx:Panel horizontalCenter="0" verticalCenter="0">
<mx:Form width="100%" height="100%" horizontalCenter="0"
verticalCenter="0">
<mx:FormItem label="Enter Task">
<mx:TextInput id="inputTask"/>
</mx:FormItem>
<mx:FormItem label="Send Task ">
<mx:Button id="btnSend" label="Send"/>
</mx:FormItem>
<mx:ControlBar>
<mx:Label id="labelStatus" text=""/>
</mx:ControlBar>
</mx:Form>
</mx:Panel>

</mx:WindowedApplication>

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
creationComplete="InitConn()"
backgroundAlpha="0" width="600" height="600"
backgroundColor="#FFFFFF">
<mx:Script>
<![CDATA[
import flash.net.LocalConnection;

private var conn:LocalConnection;

private function InitConn():void{
conn = new LocalConnection();
conn.allowDomain('*');
conn.client = this;
try {
conn.connect("localConn");
textareaTasks.text= textareaTasks.text + "CONNECTING TO
playlistDebug" + "\n";
} catch (error:ArgumentError) {
trace("Can't connect.");
textareaTasks.text= textareaTasks.text + "Can't connect." + "\n";
}
}

public function localconnectionHandler(msg:String):void {
textareaTasks.text= textareaTasks.text + msg + "\n";
}

private function clearTasks(event:MouseEvent):void {
textareaTasks.text="";
}

]]>
</mx:Script>
<mx:Panel horizontalCenter="0"
verticalCenter="0.5"
verticalGap="15"
paddingLeft="20" paddingRight="20" paddingBottom="20" paddingTop="20"
height="100%" width="100%">
<mx:Label text="Trace output:"/>
<mx:TextArea id="textareaTasks"
top="20" left="20" right="20" bottom="20"
width="100%" height="100%"/>
<mx:HBox>
<mx:Button id="btnClearTasks" click="clearTasks(event)"
label="Clear "/>
<mx:Button id="connectagain" click="InitConn( )"
label="ConnectAgain "/>
</mx:HBox>
</mx:Panel> 

</mx:WindowedApplication>



<<image003.jpg>>

<<image004.jpg>>

Reply via email to