Here're the basic structure to simple LocalConnection for flash as3. LocalConnection is used when you want to connect 2 or more swf in a pc to exchange data.
To receive:
//receive
var receivingLC:LocalConnection;
receivingLC = new LocalConnection();
receivingLC.client = this;
receivingLC.connect('session_name');
function myMethod(textRecieved:String){
//do your things
}
To send:
//sending
var sendingLC:LocalConnection;
sendingLC = new LocalConnection();
sendingLC.send('message_input', 'myMethod', "test");
sendingLC.addEventListener(StatusEvent.STATUS, onStatus);
function onStatus(event:StatusEvent){
switch (event.level) {
case "error":
trace("LocalConnection.send() failed");
break;
case "status":
trace("LocalConnection.send() succeeded");
break;
default:break;
}
}
No comments:
Post a Comment