I'm building an AIR app that sends text string to a swf-file. When I export the sender and reciever apps to swf and run them in Flash players, everything works well. But when publishing the sender app to AIR things don't work anymore.
I think the connection works, because there are no error messages. But the function on reciever swf won't fire.
Here's my code for AIR (the sender):
import flash.net.LocalConnection;
import flash.events.MouseEvent;
var conn:LocalConnection;
conn = new LocalConnection();
conn.addEventListener(StatusEvent.STATUS, onLocalConnError);
function send_it(event:MouseEvent):void
{
conn.send('_connection', 'fire','myString');
}
function onLocalConnError(e:StatusEvent):void
{
teksti.text = e.toString();
}
btn.addEventListener(MouseEvent.CLICK, send_it);
And the reciever SWF:
import flash.net.LocalConnection;
import flash.events.MouseEvent;
var conn:LocalConnection;
function connect(event:MouseEvent):void
{
conn = new LocalConnection();
conn.addEventListener(StatusEvent.STATUS, onLocalConnError);
conn.allowDomain("app#fi.myapp");
conn.client = this;
conn.connect('_connection');
this.addEventListener(Event.CLOSE, closeConnection);
}
btn.addEventListener(MouseEvent.CLICK, connect);
function onLocalConnError(e:StatusEvent):void
{
my_text.text = e.toString();
}
function fire(txt:String):void
{
my_text.text = txt;
}
function closeConnection(e:Event = null):void
{
conn.close();
}
Any ideas what I'm doing wrong?
You have to identifier the receiving app PLUS the connectionname in the
send
-call:Greetings