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);
};


    Part I: 10 Quick Steps for Getting Started
     
    ASPTreeView.com
     
    Evaluation has ѕЅјНЗШЕКїє¶expired.
    Info...