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')"); 

如果您不想修復我的代碼,我還是很樂意與工作簡單的例子(我搜索谷歌,似乎都不容易,也不簡單)。

+0

不知何故,我擺弄它,它現在的作品。 – 2011-02-16 17:27:53

回答