Skip to main content
November 12, 2008
Question

Remote SharedObject problem

  • November 12, 2008
  • 1 reply
  • 342 views
Hello,

I'm having problems understanding how the connections work in FMS3 with flex 3. This is my code :
quote:


case "NetConnection.Connect.Success":
Alert.show("Successful Connection to server");
enterRoom();
break;


quote:


public function enterRoom():void
{
_so= SharedObject.getRemote("so", _nc.uri, false);
_so.addEventListener(SyncEvent.SYNC, updateUserList);
_so.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsync);
_so.addEventListener("sendMessages", onMessage);
_so.client = this;

_so.connect(_nc);
}


The shared object does connect. The SyncEvent.SYNC event is dispatched, however when I try to do this :

quote:


private function sendMessage():void
{
_so.send("sendMessages", _myName, messageArea.text);
messageArea.text="";
}



I get an Async error : Property sendMessages not found on videoconf and there is no default value. The onMessage function doesn't trigger. Do you know why ?

Additionally, how does the call() method work ? I keep getting a Call Failed message, where do I have to define the function in my main.asc ?

Thank you !
    This topic has been closed for replies.

    1 reply

    November 13, 2008
    This line:

    _so.addEventListener("sendMessages", onMessage);

    Is your problem. You don't create an event listener for server calls. When you want to get method calls from the server, you just create the method on the client object of the sharedObject. In your case, the class is the client, so just create a method named sendMessages in your class, and the error should stop.