0 Replies Latest reply on May 30, 2006 12:55 PM by AnunnakiSpirit

    Flex and the flash media server

    AnunnakiSpirit
      Right, learning flex is a bit difficult with no prior AS/ASC knowledge and scarce AS3 samples for what I'm trying to develop.
      I am trying to allow multiple users to chat via the flashmedia server, and I have run into another problem in the process.

      I call the following ASC function from AS3 in flex with ChatConnection.call("msgFromClient",null,message); and insert a message, then it should send the message to all clients through the chat_so shared object, but this (I presume) is where my problem lies.

      //this is called
      newClient.msgFromClient = function(msg) {
      //add the previously defined name variable plus the recieved msg to a string
      msg = this.name + ": " + msg + "\n";
      //send the message through chat_so to a reciever in the client
      application.chat_so.send("msgFromSrvr", msg);
      }


      Once it's sent nothing happens, here is the supposed recieving code (which I don't have a clue how to write)
      //connect to the remote shared object
      chat_so = SharedObject.getRemote("chat_so",ChatConnection.uri,false);
      //when the function msgFromClient sends the message add it to a textarea
      chat_so["msgFromSrvr"] = function (msg:String) {
      ChannelText.text+=msg;
      }


      //connect to the chat connection
      chat_so.connect(ChatConnection);

      In theory this seems to work in my mind, but in practise it doesn't, I don't know if it's because I'm new to AS completely or it's the lack of information around to help me or what, but I can't seem to be able to figure it out, so please help if possible.