Connect and Create a Local SharedObject (Flash)

Listing E.10 will connect the Flash client to a persistent local SharedObject on the client's hard disk. If the object does not exist, it will be created. There is a simple read and write sample included.

Listing E.10 Flash ActionScript for Creating a Local SharedObject
initLocalSharedObject = function () {
      trace("Connect a Local SharedObject");
      lcl_so.getLocal("myLocalSharedObject");
      // Write a property to the Local SharedObject
      lcl_so.test = " kevin";
      // Read a property from a Local SharedObject
      var my_var = lcl_so.test;
      trace(" Local SharedObject Read Test: "+my_var);
      trace("LocalSize: "+lcl_so.getSize());
};


    Part I: 10 Quick Steps for Getting Started