• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Appendix: IV Appendixes: Quick Reference... > Connect and Create a SharedObject (S...

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


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint