Setting breakpoints in drag/drop generally doesn't work because you tend to release the mouse in order to dig through the debugging info and when you resume the drag is cancelled.
Remove the custom drag event handlers and try with simple data and see if it works. We definitely tested drag/drop in Tree so basic cases work. One trick for Tree is that what happens on drop is different than in List. The node is removed before it is added in Tree, and sometimes that is done in dragComplete handler instead of dragDropHandler From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Claudiu Ursica Sent: Sunday, January 18, 2009 9:59 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Drag And Drop Tree Hi I'm trying to implement the drag and drop functionality inside a tree, dragging and dropping inside the same tree. However It seems that I cannot drag and drop leaf nodes... When I handle enterDrag event the item seems to be appearing only at debug time and gets lost after that... here is the code.. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.events.DragEvent; import mx.managers.DragManager; import mx.core.UIComponent; import mx.core.DragSource; private function onDragEnter(event : DragEvent) : void { var items : Array = event.dragSource.dataForFormat("treeItems") as Array; trace("items ", items); //this only shows data for branches //if I try drag drop a leaf like spam for //instance I can see the node only when debugginh and when resuming the data is gone //when resuming even though the length is 1 } /** * The dragDrop event is dispatched when the mouse is released. * The Tree can still ignore the drop here */ private function onDragDrop(event : DragEvent) : void { var ds : DragSource = event.dragSource; var items : Array = ds.dataForFormat("treeItems") as Array; trace("items ", items); //this display actually the drop node instead of the dragsource var dropTarget : Tree = Tree(event.currentTarget); var selectedIndex : int = myTree.calculateDropIndex(event); myTree.selectedIndex = selectedIndex; var node : XML = myTree.selectedItem as XML; var dropParent : *; // if the selected node has children // then add the items at the beginning if(myTree.dataDescriptor.hasChildren(node)) { dropParent = node; selectedIndex = 0; } else { dropParent = node.parent(); } // taking all of the items in the DragSouce, insert them into the // tree using parent pointer. // taking all of the items in the DragSouce, insert them into the // tree using parent pointer. var xml : XML = new XML(items); var sucess : Boolean = myTree.dataDescriptor.addChildAt(dropParent, xml, selectedIndex); //trace(sucess); } ]]> </mx:Script> <mx:Tree id="myTree" width="300" height="100%" labelField="@label" showRoot="false" dataProvider="{treeData}" borderStyle="none" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" dragEnter="onDragEnter(event)" dragDrop="onDragDrop(event)"> </mx:Tree> <mx:XMLList id="treeData"> <node label="Mail Box"> <node label="Inbox"> <node label="Marketing"/> <node label="Product Management"/> <node label="Personal"/> </node> <node label="Inbox"> <node label="Marketing"/> <node label="Product Management"/> <node label="Personal"/> </node> <node label="Inbox"> <node label="Marketing"/> <node label="Product Management"/> <node label="Personal"/> </node> <node label="Outbox"> <node label="Professional"/> <node label="Personal"/> <node label="Inbox"> <node label="Marketing"/> <node label="Product Management"/> </node> <node label="Personal"/> </node> <node label="De mutat"> <node label="Unu"/> <node label="Doi"/> <node label="DoiUnu"> <node label="DoiUnuUnu"/> <node label="DoiUNuDoi"/> </node> <node label="Trei"/> </node> <node label="Spamu"/> <node label="Sent"/> <node label="Movable"/> </node> </mx:XMLList> </mx:Application> so the code seems to be working when drag and dropping an folder but not when dropping a leaf, I get a new Item with no label. I have searched the archives for something similar and found only the same issue posted twice by 2 different guys and no answers. So I thought I'll have better luck... TIA, Claudiu