Re: [flexcoders] Traverse a Model

2007-11-19 Thread Aaron Miller
you can use a for in loop

for (var p:String in obj) {
trace( p+' = '+obj[p] );
}

or if your just using this for debugging, I like to use

import mx.utils.ObjectUtil;

trace( ObjectUtil.toString(obj) );

Best Regards,
...aaron


On 11/18/07, Ben Marchbanks <[EMAIL PROTECTED]> wrote:
>
>   I have a model which I would like to walk to get key/values to update
> the server with any changes.
>
> The following works fine to get each value,but is there a simple way
> to get the key as well ?
>
> for each(var item in myModel){
> trace(item)
> }
>
>  
>



-- 
Aaron Miller
Chief Technology Officer
Splash Labs, LLC.
[EMAIL PROTECTED]  |  206-328-5485
http://www.splashlabs.com


[flexcoders] Traverse a Model

2007-11-18 Thread Ben Marchbanks
I have a model which I would like to walk to get key/values to update
the server with any changes.

The following works fine to get each value,but is there a simple way
to get the key as well ?

for each(var item in myModel){
  trace(item)
}