If you're using Flex 4.5, something like this works:

var myClassObject:Object = new MyClass();
var classInfo:XML = describeType( myClassObject );
var propertyType:String;
var propertyName:String;

for each ( var property:XML in classInfo..accessor )
{
        propertyName = property.@name;
        propertyType = property.@type;
}

-TH

--- In flexcoders@yahoogroups.com, Alex Harui <aharui@...> wrote:
>
> You can't directly loop over a class like you could in AS2.  That's what 
> describeType and ObjectUtil are for.  You can probably loop over the 
> properties returned from ObjectUtil.getClassInfo.
> 
> 
> On 8/11/11 3:23 AM, "j2me_soul" <j2me_soul@...> wrote:
> 
> 
> 
> 
> 
> 
> Sorry I think I express not very clear.
> I want to iterate all the properies in a class using for each/in.
> How can achieve that ?
> 
> At 2011-08-11 17:52:34,"Rishi Tandon" <rishitandon123@...> wrote:
> 
> 
> 
> 
> 
> 
> for each works for collection.
> If you have an instance of the collections consist of your class object then 
> u can retrieve each item as class object using for each iterator.
> 
> Sent from my iPhone
> 
> On Aug 11, 2011, at 2:25 PM, j2me_soul <j2me_soul@...> wrote:
> 
> 
> 
> 
> How to custom a class can by iterate all children by for each
> 
> for each( var item:* in myCustomeClass ){
> 
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Alex Harui
> Flex SDK Team
> Adobe System, Inc.
> http://blogs.adobe.com/aharui
>


Reply via email to