These scripts will define a function on the Flash client and call it from the server. Functions are defined as methods in the NetConnection object on the client. They are called from the Client object in SSAS.
The ActionScript in Listing E.17 defines a function in Flash called sayHelloClient. It will be called by SSAS in Listing E.18.
nc = new NetConnection(); nc.connect("rtmp://localhost/myApplication/myInstance"); // Define the Function that the server will call in the NetConnection nc.sayHelloClient = function() { trace("The Server says.. Yo, Dude!"); };
The ActionScript in Listing E.18 calls the client function set in Listing E.17.
application.onConnect = function(clientObject) { application.acceptConnection(clientObject); // invoke the function on the Client clientObject.call("sayHelloClient"); };