There appears to be an error in the Adobe documentation in regards using the shared object.send()
. I am trying to execute the send method to all clients.
I copied the client and server-side code from Adobe and I am unable to invoke the function. This is my compile error in the output
Line 31 1119: Access of possibly undefined property doSomething through a reference with static type flash.net:SharedObject.
Any suggestions how i can fix this to as3 novice. Please can anyone help me?
var nc:NetConnection = new NetConnection();
nc.connect("rtmfp://localhost/submitSend");
nc.addEventListener(NetStatusEvent.NET_STATUS, netHandler);
function netHandler(event:NetStatusEvent):void{
switch(event.info.code){
case "NetConnection.Connect.Sucess":
trace("Connecting...");
break;
case "NetConnection.Connect.Failed":
trace("Unable to connect up");
break;
case "NetConnection.Connect.Rejected":
trace("Whoops");
break;
}
}
var so:SharedObject = SharedObject.getRemote("mySo", nc.uri, true);
so.connect(nc);
so.doSomething = function(str) {
// Process the str object.
};
Server side:
var so = SharedObject.get("mySo", true);
so.send("doSomething", "This is a test");