Recent News

AS2 to AS3 migration of FMS2 Chat application

Posted by sortofme on March 3rd, 2008

While I was trying to migrate a textChat application written in AS2 to AS3, I encountered the problem, that I couldn't use

Actionscript:
  1. nc.msgFromSrvr = function (msg) {
  2. chatPrintDebug ("msgFromSrvr "+msg);

as because the reference nc.msgFromSrvr does not work this way anymore.
I found a way on the Adobe Forums suggesting this way:

Actionscript:
  1. var connection = new NetConnection();
  2. connection.client = this;
  3. connection.connect("rtmp://localhost/application", "userName");
  4.  
  5. var remoteUsers = new SharedObject();
  6. remoteUsers = SharedObject.getRemote("users_so",connection.uri,false);
  7. remoteUsers.connect(connection);
  8. remoteUsers.client=this;
  9.  
  10. function msgFromSrvr (msg:String) { trace(msg); };

In the server-side I wrote the next code:

Actionscript:
  1. application.onAppStart = function () { application.users_so = SharedObject.get("users_so",false); }
  2. application.onConnect = function (userName) { application.users_so.send("msgFromSrvr","message_txt"); }

It worked fine.

a simple text chat

Posted by sortofme on February 21st, 2008

code collection for a simple text chat running through the flash media server 2, written in AS3.

Recent Comments | Recent Posts


designed and coded by: noesi
bottom