Connect and Create a SharedObject (SSAS)


The script in Listing E.11 will connect the Flash Communication Server client to a persistent SharedObject. If the object does not exist, it will be created. There is a simple read and write sample included.

Listing E.11 Server-Side ActionScript (main.asc) for Creating a SharedObject
 application.onAppStart = function() {       initSharedObject();       } initSharedObject = function () {       // Create a new or connect to an existing persistent SharedObject       server_so = SharedObject.get("mySharedObject", true);       // Note: the following onSync event uses the onSync template script       server_so.onSync = onSyncTemplate;       // Write a property to the SharedObject using the setProperty method       server_so.setProperty("myProperty", "myValue");       // Read a property from the SharedObject using the getProperty method       var my_var = server_so.getProperty("getWhatsNew_rs");       trace("SharedObject Read Test: "+my_var); }; 


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