Thanks flex guru,

The problem is solved now. When I changed XMLListCollection to XML everthing
started working fine. The problem was with some internal binding of
XMLListCollection.
Regards,
Shaun.
On 24 September 2010 11:33, flex guru <[email protected]> wrote:

> Hi,
>
> Check out with experts on askmeflash.com if you are still looking for the
> solution. It's quite an active and fast forum in providing solutions to your
> problems in flash, flex, FMS and ActionScript. Hundreds of flash developers
> are already using it. It's free to ask and doesn't require registration. Use
> this link to post question over there: http://askmeflash.com/askquestion
>
> Thanks,
>
>   On Tue, Sep 21, 2010 at 11:17 PM, shaun thomas <[email protected]
> > wrote:
>
>>   Hai,
>>
>> I have a flex application with 2 tree. I should allow the drag and drop
>> from left tree to right tree based on the local name of XML. While working
>> on this I encountered peculiar kind of problems.
>>
>> - when dragged and dropped to right tree from left tree, the dragged item
>> in lefttree is appearing twice
>> - when certain items are dragged to right, they are appearing twice in
>> right side tree.
>>
>> Here is the code
>>
>>
>> //Code
>>
>>
>> private function mouseMoveHandler(event:MouseEvent):void
>>    {
>>     // Get the object of drag initiator
>>     var dragInitiator:Tree = Tree(event.currentTarget);
>>
>>     //
>>     var dragItems:Array = dragInitiator.selectedItems as Array;
>>
>>     //Create a DragSource object
>>     var dragSource:DragSource = new DragSource();
>>
>>     // Add item to object
>>     dragSource.addData(dragItems,'treeItems');
>>
>>     // Call drag manager to start drag
>>     DragManager.doDrag(dragInitiator,dragSource,event);
>>
>>    }
>>
>>   private function dragEnterHandler(event:DragEvent):void
>>    {
>>     // Checking the source format to decide whether to accept or not
>>     event.preventDefault();
>>     if(event.dragSource.hasFormat('treeItems'))
>>      {
>>       //Get the object of drop targer
>>       var dropTarget:Tree = Tree(event.currentTarget);
>>
>>       //To accept the drop
>>       DragManager.acceptDragDrop(dropTarget);
>>
>>       // Show readiness to accept
>>       DragManager.showFeedback(DragManager.COPY);
>>      }
>>    }
>>   private function dragDropHandler(event:DragEvent):void
>>    {
>>     event.preventDefault();
>>     // Getting the initiator reference
>>     var initiator:String = (event.dragInitiator as Tree).id;
>>
>>     // Getting the items dragged
>>     var draggedItems:Array = event.dragSource.dataForFormat("treeItems")
>> as Array;
>>
>>     // Getting the reference of drop target
>>     var dropTarget:Tree = Tree(event.currentTarget);
>>
>>     if(initiator == "leftTree")
>>     {
>>      // Add each dragged item to the Tree by apppending it
>>         // as a child of the selected node in the Tree.
>>         for each( var object:Object in draggedItems)
>>         {
>>          var itemXML:XML = object as XML;
>>
>>
>>          if(itemXML.localName() == "list1")
>>           {
>>
>>            IList(dropTarget.dataProvider).addItem(itemXML);
>>            trace(itemXML.toXMLString());
>>           }
>>          else
>>           {
>>            trace(itemXML.toXMLString());
>>
>>           }
>>
>>         }
>>     }
>>     else
>>      trace("Drag not from left tree");
>>    }
>> <mx:HBox>
>>   <mx:Tree id="leftTree"
>>    dataProvider="{XMLColln}"
>>     labelField="@label" showRoot="false"
>>      width="300" height="500"
>>       folderClosedIcon="{folderIcon}"
>>        folderOpenIcon="{folderIcon}"
>>         defaultLeafIcon="{leafIcon}"
>>          disclosureClosedIcon="{itemExpand}"
>>           disclosureOpenIcon="{itemCollapse}"
>>            left="20" top="50"
>>             dragEnabled="true"/>
>>
>>
>>
>>   <mx:Tree id="rightTree"
>>    dataProvider="{XMLColln2}"
>>    width="300" height="500"
>>     folderClosedIcon="{folderIcon}"
>>      folderOpenIcon="{folderIcon}"
>>       defaultLeafIcon="{leafIcon}"
>>        disclosureClosedIcon="{itemExpand}"
>>         disclosureOpenIcon="{itemCollapse}"
>>          labelField="@label" showRoot="false"
>>           dragEnter="dragEnterHandler(event)"
>>            dragDrop="dragDropHandler(event)"/>
>>
>> </mx:HBox>
>>
>>  // Code end
>>
>> Can anyone please help in figuring out solution to this problem.
>>
>> Thanks in advance.
>> Shaun.
>>
>> --
>> Shaun Thomas
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Flex India Community" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<flex_india%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/flex_india?hl=en.
>>
>
>


-- 
Shaun Thomas

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to