Actionscript 3 AS3 LocalConnection:函数未启动
我正在构建一个AIR应用程序,将文本字符串发送到swf文件。当我将发送者和接收者应用程序导出到swf并在Flash播放器中运行它们时,一切都很好。但是当发布sender应用程序到AIR时,一切都不起作用了 我认为连接正常,因为没有错误消息。但接收器swf上的功能不会启动 这是我的AIR代码(发件人): 和接收器SWF:Actionscript 3 AS3 LocalConnection:函数未启动,actionscript-3,flash,air,Actionscript 3,Flash,Air,我正在构建一个AIR应用程序,将文本字符串发送到swf文件。当我将发送者和接收者应用程序导出到swf并在Flash播放器中运行它们时,一切都很好。但是当发布sender应用程序到AIR时,一切都不起作用了 我认为连接正常,因为没有错误消息。但接收器swf上的功能不会启动 这是我的AIR代码(发件人): 和接收器SWF: import flash.net.LocalConnection; import flash.events.MouseEvent; var conn:LocalConnecti
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();
}
你知道我做错了什么吗?你必须在
发送
呼叫中识别接收应用程序和连接名:
conn.send('app#YourReceivingAppName:_connection', 'fire','myString');
问候语您必须在
发送
呼叫中识别接收应用程序和连接名:
conn.send('app#YourReceivingAppName:_connection', 'fire','myString');
问候语接收应用程序只是一个swf文件。那么这是否应该起作用:conn.send('app#receive.swf:_connection','fire','myString');啊好的。在这种情况下,您的代码是绝对正确的!您必须将swf的发布设置设置为“仅网络”。这应该行得通。接收应用程序只是一个swf文件。那么这是否应该起作用:conn.send('app#receive.swf:_connection','fire','myString');啊好的。在这种情况下,您的代码是绝对正确的!您必须将swf的发布设置设置为“仅网络”。这应该行得通。接收应用程序只是一个swf文件。那么这是否应该起作用:conn.send('app#receive.swf:_connection','fire','myString');啊好的。在这种情况下,您的代码是绝对正确的!您必须将swf的发布设置设置为“仅网络”。这应该行得通。