探索Flash Media Server(二)


尝试使用了SharedObject类
使用Local SharedObject
import mx.utils.Delegate;
var lso:SharedObject = SharedObject.getLocal("test", "/");
output_txt.text = lso.data.msg;
input_txt.addEventListener("keyDown", Delegate.create(this, inputFunc));
function inputFunc(obj) {
  if (Key.isDown(Key.ENTER)) {
    lso.data.msg = obj.target.text;
    obj.target.text = "";
    if (lso.flush()) {
      trace("write success");
    }
  }
}
使用Remote SharedLocal
//连接
var nc:NetConnection = new NetConnection();
var rso;
nc.onStatus = checkConnect;
nc.connect("rtmp://localhost/test1");
function checkConnect() {
  if (this.isConnected) {
    rso = SharedObject.getRemote("test", nc.uri);
    rso.connect(nc);
    rso.onSync = checkRso;
  }
}
//显示信息
function checkRso(obj) {
  var txt = this.data.msg;
  if (txt.length>3) {
    txt.shift();
  }
  if (txt != undefined) {
    msg_txt.text = "";
    for (var i = 0; i
本文转自:http://www.5uflash.com/flashjiaocheng/Fmsjiaocheng/2324.html

你可能感兴趣的:(html,Flash)