0 Replies Latest reply on Jun 15, 2006 11:08 AM by Newsgroup_User

    SO class

    Level 7

      Hi, I was trying to build a sort of wrapper for SharedObject.
      Can anybody tell me what I'm doing wrong?



      ---------

      class com.Cookie {
      public var _instance:SharedObject;

      //
      function Cookie(_name:String) {
      var my_so:SharedObject = SharedObject.getLocal(_name);
      this._instance = my_so;
      trace("inst!");
      }
      public function setData(_propName:Object, _value:Object):Void {
      this._instance.data._propName = _value;
      }
      function deleteCookie():Void {
      this._instance.data.clear();
      }
      function writeCookie():Object {
      var res = this._instance.flush();
      return res;
      }
      function getCookieSize():Number {
      var num = this._instance.getSize();
      return num;
      }
      function getContent() {
      trace("!");
      var i;
      for (i in this._instance.data) {
      trace(i);
      }
      }
      }

      ------------------

      //
      import com.*;
      //
      var coo:Cookie = new Cookie("foo");
      //
      var A:Array = [1, 2, 4];
      var B:String = "string_";
      var C:Number = 6;
      //
      coo.setData(_propA, A);
      coo.setData(_propB, B);
      coo.setData(_propC, C);
      //
      coo.getContent(); //nothing


      --------------------



      Thanks in advance,
      HooverT