0
我想在两个AS3电影(在CS5中制作)之间的AS3中使用LocalConnection,但它似乎并没有工作,这里是当前的代码(每个frame1(唯一的帧))电影第1层(唯一层))本地连接在AS3
发件人:
import flash.external.ExternalInterface;
import flash.net.LocalConnection;
function sendtoview(con,val):String {
//create local connection for sending text
var sending_lc:LocalConnection = new LocalConnection();
//put text from input into a var
sending_lc.addEventListener(StatusEvent.STATUS, err);
//send through specified connection, call specified method, send specified parameter
ExternalInterface.call("alert('Sending...')");
sending_lc.send("xivioview", "recieveText", val);
return "kk"
}
function err(msg) {
ExternalInterface.call("alert('" + msg + "')");
}
ExternalInterface.addCallback("sendtoview", sendtoview);
ExternalInterface.call("alert('Loaded')");
注意,我知道的JavaScript连接ExternalInterface的做工作,我测试过它。
接收器:用于小时
import flash.external.ExternalInterface;
import flash.net.LocalConnection;
var mLocalConnection:LocalConnection = new LocalConnection();
mLocalConnection.connect("xivioview");
mLocalConnection.client=this;
function recieveText(textRecieved:String) {
ExternalInterface.call("alert('Received!')");
ExternalInterface.call(textRecieved);
};
ExternalInterface.call("alert('Loaded')");
如果您不想修复我的代码,我还是很乐意与工作简单的例子(我搜索谷歌,似乎都不容易,也不简单)。
不知何故,我摆弄它,它现在的作品。 – 2011-02-16 17:27:53