It seems that there is a problem with the ListCollectionView class when 
using it with an ArrayCollection. Using the addItemAt method produces an 
index out of bounds error when an item is added with an index that is 
beyond the length of the collection.

However, the Flex Reference states that:

"If the list is shorter than the specified index, it will grow to 
accommodate the new item."

Is this a confirmed bug, or am I overlooking something?

Here is some test code to check it out:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
    creationComplete="initApp()"
    layout="vertical">

    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
           
            private var collection:ArrayCollection = new ArrayCollection();
           
            private function initApp():void {
               
                var newObject:Object = new Object();
                newObject.test1 = "test1";
                newObject.test2 = "test2";
               
                collection.addItem(newObject);
               
                newObject = new Object();
                newObject.test1 = "test3";
                newObject.test2 = "test4";
               
                collection.addItemAt(newObject, 3);
               
            }
           
        ]]>
    </mx:Script>
   
</mx:Application>

Anyone run into this too?

Jurgen

Reply via email to