[EMAIL PROTECTED] wrote:

> Have you considered de-incrementing the loop? Take the last one first 
> then the compression would not change the lesser values. I think this 
> might be more computationally more efficient if the array was larger 
> than 50.

If you're really worried about the efficiency you shouldn't use 
removeItemAt, but rather just call:

states.splice( index, 1 );

That will delete a single element at a specified index.  Then, when 
you're done deleting all elements, you'll want to dispatch a 
modelChanged event so that all of the listening elements to the data 
provider get updated:

states.dispatchEvent({type:"modelChanged"});

Doing it the above way will avoid the modelChanged event being 
dispatched for every element removal, avoiding all of that extra 
processing.  Rather, you can "batch" your changes via splice then notify 
all of the listeners at the end.

And yes, looping over the elements backwards would be slightly faster 
than subtracting i again each iteration..

-d



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to