Skip to main content
Participant
March 28, 2008
Question

SharedOblect.send() with FMS3 and AS3.0

  • March 28, 2008
  • 2 replies
  • 426 views
Now that AS3.0 client side script is more strongly typed, it appears you cannot dynamically add a callback function as in the following example. I've tried using a Responder in the client code and it didn't work. The code compiled and ren but the callback wasn't invoked.

// Sever side...
var myShared = SharedObject.get("foo", true);
myShared.send("doSomething", "this is a test");

// Client side
connection = new NetConnection();
connection.connect("rtmp://www.macromedia.com/someApp");
var x = SharedObject.getRemote("foo", connection.uri, true);
x.connect(connection);
x.doSomething = function(str) {
// Process the str object.
};
    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    Participant
    June 25, 2008
    var x = SharedObject.getRemote("foo", connection.uri, true);
    x.connect(connection);
    x.client=new Object();
    x.client.doSomething = function(str)
    // Process the str object.
    Participating Frequently
    March 31, 2008
    The NetConnection event handling did have to change slightly in AS3 to better deal with strong typing. The AS3 NetConnection object has a "client" property that is treated as a DynamicObject, and therefore can have methods added to it dynamically, like the AS2 NetConnection could. Use this object to add all your dynamic handlers for things like shared objects and RPC calls.