0 Replies Latest reply on Dec 20, 2007 2:07 AM by lucky_raga

    moving branch nodes up/down not reflecting in tree

    lucky_raga
      The dataprovider to tree is an xml which is bindable.
      When i print after adding dragged item at the dropped index
      and remove the dragged item, the tree shows correctly i.e., print tree using trace.
      but nothing gets reflected in the screen.

      heres the code below:

      var dropTarget:Tree = Tree(event.currentTarget);
      var dropIndex:int = dropTarget.calculateDropIndex(event);
      dropTarget.selectedIndex = dropIndex;
      var droppedItemNode:XML = dropTarget.selectedItem as XML;
      var droppedItemLabel:String = droppedItemNode.@label;
      var droppedItemParentNode:XML = droppedItemNode.parent() as XML;
      var droppedItemParentLabel:String = droppedItemParentNode.@label;

      // onDragDrop(event)

      // add to drop target
      var insert:XML = draggedItemNode;
      var inserted:Boolean = dropTarget.dataDescriptor.addChildAt(droppedItemParentNode, insert, (dropIndex));
      trace("insert " + insert);
      trace("inserted at " + droppedItemParentNode + " index: " + dropIndex);

      // remove from dragsource.
      var children:XMLList = XMLList(draggedItemParentNode).children();
      for(var j:int=0; j < children.length(); j++) {
      if( children[j].@label == draggedItemLabel) {
      trace("removed from dragsource: " + children[j]);
      var del:Boolean = delete children[j];
      break;
      }
      }

      Please advice.

      Thanks,
      Lucky