I found that reversing the loop, i.e. decrementing thru it solves the problem. Hope that helps someone.
--- In [email protected], "Matthew" <fume...@...> wrote: > > Hi - > > I remove an item in an array using splice() and when there's one object left > in the array, the looping stops. Why is that? My loop is nested within > another loop but I thought it should iterate over everything first before it > goes back to the outside loop. Here's my code: > > for( var i:int=0; i<dpLength; i++ ){ > var group:Object = model.groupingColl[i]; > var children:Array = group.children as Array; > > /* if there are 2 items in 'children', the > first is > removed fine but then it doesn't iterate > over the one > remaining. */ > for each( var acct:Object in children ){ > if( acct.selected == true ){ > children.splice( i,1 ); > } > } > } >

