2 Replies Latest reply on May 9, 2008 12:26 PM by Mush15

    Drag and Drop, what am I doing wrong?

      I am implementing dragging from a List to a HorizontalList. I have it working as far as the new item is added to the HorizontalList, but I have two major issues...

      1) Once dropped, the new item is added to the HorizontalList's dataProvider, but the HorizontalList doesn't refresh. I can't see the new item until I scroll out of view of where it should be and scroll back. I've tried calling invalidateDisplayList(), and a couple others after the dragDrop, but nothing has helped.

      2) The newly added items do not behave like the ones that were already in the HorizontalList to begin with. They cannot be selected.

      Here's the code for the HorizontalList dragDrop event handler...



      var items:Array = event.dragSource.dataForFormat("items") as Array;

      var topic:AssetCategory = AssetCategory(items[0]);

      var storyboardItem:WebStoryboardItem = CreateStoryboardItemFromTopic(topic);

      var dropTarget:HorizontalList = HorizontalList(event.currentTarget);

      var index:int = dropTarget.calculateDropIndex(event);

      IList(dropTarget.dataProvider).addItemAt(storyboardItem, index);

      The dataProvider for the HorizontalList is an ArrayCollection of WebStoryboardItem objects

      Help please. Thanks.