Invoking a Macromedia Flash Function from SSAS


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.

Listing E.17 Flash ActionScript for Defining a Flash Function
 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.

Listing E.18 Server-Side ActionScript (main.asc) for Calling the Client Function
 application.onConnect = function(clientObject) {       application.acceptConnection(clientObject);       // invoke the function on the Client       clientObject.call("sayHelloClient"); }; 


Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net