Ok....so I see that there is a .setProperty() method on the
SharedObject, so I can "save" the cookie based on parameter name, as
in the following:

function saveCookie(key:String, value:String):void {
   so.setProperty(key, value);
}

BUT!!!  How does one GET the value using a parameter name.  There is
no so.getProperty(key);  

Appears that the only way to get a stored value is off of the so.data
object.  And you can't parameterize this.  And this is my problem. 

function getCookie(key:String):void {
   // This always attempts to get a cookie with the name "key"
   return so.data.key;
}

Any ideas?  Thanks!




--- In [email protected], "tjcox1969" <[EMAIL PROTECTED]> wrote:
>
> I want to have a function that one can call to save a name/value into
> the clientside SharedObject.
> 
> The Flex doc has the example like this:
> 
>      var my_so:SharedObject = SharedObject.getLocal("superfoo");
>      my_so.data.itemNumbers = items_array;
>      my_so.data.adminPrivileges = currentUserIsAdmin;
>      my_so.data.userName = currentUserName;
> 
> 
> My issue is that I don't want to hard code the name of the cookie.  So
> in the above example, I don't want to hardcode "itemNumbers".
> 
> Here is what I want to do:
> 
> public function saveCookie(key:String, value:String):void {
>      var my_so:SharedObject = SharedObject.getLocal("superfoo");
>      my_so.data.key = value;
> }
> 
> The problem is that "data.key" is not evaluated to its real parameter
> value and the cookie is saved as the hard coded "key" string.
> 
> Any ideas?  Thanks!
>


Reply via email to