[flexcoders] Re: How to save a sharedobject value based on a parameter name??

2007-09-26 Thread tjcox1969
Okso 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 flexcoders@yahoogroups.com, 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!





Re: [flexcoders] Re: How to save a sharedobject value based on a parameter name??

2007-09-26 Thread Tom Chiverton
On Wednesday 26 Sep 2007, [EMAIL PROTECTED] wrote:
 function getCookie(key:String):void {
// This always attempts to get a cookie with the name key
return so.data.key;

so.data[key] ?

-- 
Tom Chiverton
Helping to synergistically repurpose high-yield developments
on: http://thefalken.livejournal.com



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/