0 Replies Latest reply on May 14, 2007 12:05 AM by Shanizar

    TileList showing wrong data after using removeItemAt when scrolled

    Shanizar
      I have a rather strange error occuring, which to me seems like a bug
      with the TileList...

      I have a small application with a TileList and a Button.
      The Tilelist has an XMLListCollection as a dataprovider.

      On Initialization I add 100 entries to the collection. They all come
      up nicely in the TileList. I then scroll to the bottom of the tillist
      and click the button.

      The button calls removeItemAt on 5 items in a part of the collection
      that is not visible.

      When I then scroll up, the items I deleted are gone from the TileList
      as they should, but so are some of the first items in the collection.

      If I print the contents of the collection, the first items are still
      there, but they aren't shown in the TileList...

      If I run the excact same code, but keep the items to be removed
      visible when I click the button, it all works fine.

      <mx:Script>
      <![CDATA[
      import mx.collections.XMLListCollection;
      [Bindable]
      private var dp:XMLListCollection = new XMLListCollection();

      private function onInit():void{
      for (var i:int = 0 ; i < 100 ; i++)
      dp.addItem(<p p={i}/>);
      }

      private function ondelete(event:Event):void{
      for (var i:int = 0 ; i < 5 ; i++)
      dp.removeItemAt(20);
      }

      ]]>
      </mx:Script>
      <mx:TileList id="tile" dataProvider="{dp}" width="200" height="300"
      rowHeight="20" labelField="@p" columnWidth="40"/>
      <mx:Button label="Delete" click="ondelete(event)"/>