You can use mx.utils.ArrayUtil.toArray() <http://livedocs.adobe.com/flex/201/langref/mx/utils/ArrayUtil.html#toAr\ ray()> to ensure you're dealing with an array. Or perhaps testing with "if (testType is Array)" would smell a little better. :)
--- In flexcoders@yahoogroups.com, "M@ Sheppard" <[EMAIL PROTECTED]> wrote: > > I'm pretty sure I'm doing something wrong - I get an objectProxy back > from a webservice with a list of items - sometimes the list is empty, > sometimes it has 1 item, sometimes is has many. > > My code is "working," but it smells bad - I have to check if the > object in question has a .length property - and access it differently. > > I am currently parsing this array like this: > > // Parse the icons > var testType:Object = op.item; > if (testType != null) > { > if (testType.length != null) //more than one group > { > for( var i:int; i<op.item; ++i) > { > foo( op.item[i]); > } > } > else > { > foo(op.item); > } > } > > Thanks, > M@ >