A quick way to do it (ugly admittedly) is to use the 'instanceof' or 'typeof' operator.
if ( obj[propertyName] instanceof Date ) You might need to cast into number or date before you check the instance of to see if it is valid. -----Original Message----- From: viraf_bankwalla [mailto:[EMAIL PROTECTED] Sent: Monday, April 04, 2005 10:06 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: AS - adding dynamic properties to an object Thanks - the example below would have worked if I had knowledge of the property name when I wrote the code. This is not the case (the property name is retrieved with a service request). The solution that I found was to use the associative array syntax - obj[propertyName] = yy; Now the next question is that how do I specify that "propertyName" is of a given type - say Date or Number. Thanks. --- In flexcoders@yahoogroups.com, Manish Jethani <[EMAIL PROTECTED]> wrote: > On Apr 5, 2005 1:08 AM, viraf_bankwalla <[EMAIL PROTECTED]> wrote: > > > How do I add dynamic properties to an obect ? These properties are > > received over the HTTPService request. > > If you have an instance of a dynamic class, you can just stick them > onto the object. > > var o:Object = new Object(); // dynamic object > o.newProperty = "default value"; // stick a new property onto it > > Pretty much it. > > Manish Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> 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/