Paolo Bernardini wrote:
> I found that if you try to do a for in loop for a custom class it won't
> work.
> 
> *for* (*var* i:String *in* ItemVO*){*
> *   trace*(ItemVO[i]); // it won't trace anything.
> }
> 

[snip]


> *public* *class* ItemVO *implements* IValueObject
> 

[snip]

The "for in" loop only iterates over dynamic properties. Not fixed.
You can either make your object dynamic.

   public dynamic class ItemVO implements IValueObject

Or you have to use flash.utils describeType to get an XML representaion 
(minus static properties, I think).

Dynamic objects can make life easier in a lot of ways, especially with 
item renderers and editors, but beware the downside. You can set and 
access properties that are not part of the class, same as you can with a 
Plain Old Actionscript Object instance (POAO ;). So a simple typo could 
create real hassles, rather than being caught be the compiler.

Ie) you can do the following:

   var item:ItemVO = new ItemVO();

   item.property_that_doesnt_exist = "a value";

or

   var s:String = item.property_that_doesnt_exist;


cheers,
   - shaun

Reply via email to