Jason Hawryluk wrote:

>I've been having allot of problems as well with the tree and drag drop
>operations. Specifically if the fact that the tree does not update properly
>now, as it did before with relation to it's data source. Also I’m finding
>that the drop indicator is all over the place. Are you experiencing the same
>problems ?
>  
>
This is interesting (meaning strange :)). I was having the exact 
opposite problem
I want to drag from a List and drop into a Tree. I always had the redX 
icon there, even when I called the acceptDragDrop, and the drop was 
excepted too.
The only way I could find to solve the problem was leaving out the: 
dropEnabled="true" on the Tree.
It is really strange, because I thought that this is mandatory to be 
able to drop on the Tree.
Below is my test code in case you are interested.

Andi



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
xmlns:ns1="*"
creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import mx.containers.Canvas;
import mx.managers.DragManager;
import mx.events.DragEvent;
import mx.collections.ArrayCollection;

[Bindable]
public var myListData:ArrayCollection;
[Bindable]
public var myTreeData:Object;

private function onCreationComplete():void {
myListData = new ArrayCollection([{name: 'aaa'},{name: 'bbb'},{name: 
'ccc'}]);
}

private function initTree():void {
myTreeData = {label: 'top', children:
[{label: 'level1_A',
children:
[{label: 'level2_1'},
{label: 'level2_2'}]},
{label: 'level1_B', children:
[{label: 'level2_x'},
{label: 'level2_y'}]}
]};

//expand Tree
expandTreeNode(myTree, myTree.dataProvider[0]);
}

public function expandTreeNode(tmpTree:Tree, node:Object):void {
tmpTree.expandItem(node, true);
if(node.children != undefined) {
for(var k:Number=0; k < node.children.length; k++){
expandTreeNode(tmpTree, node.children[k]);
}
}
}

private function doDragOverTree(event:DragEvent):void {
DragManager.showFeedback(DragManager.NONE);
}

private function doDragEnterTree(event:DragEvent):void {

var dragTarget:Tree = Tree(event.currentTarget);
if ((DataGrid(event.dragInitiator).id == 'myList')){
DragManager.acceptDragDrop(dragTarget);
trace("DO DRAG ENTER accept drag into "+dragTarget);
}
}

private function doDragDropTree(event:DragEvent):void {
trace("DROP IN TREE index:" + myTree.calculateDropIndex(event));

trace(' dropevent[currentTarget] = '+event['currentTarget']);

}

]]>
</mx:Script>
<mx:DataGrid id="myList" x="46" y="28" dataProvider="{myListData}"
dragEnabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="name" />
</mx:columns>
</mx:DataGrid>
<mx:Tree id="myTree" x="46" y="242" width="200" height="400"
dataProvider="{myTreeData}"
dropEnabled="true"
dragEnter="doDragEnterTree(event);"
dragDrop="doDragDropTree(event);"

creationComplete="initTree();"/>
</mx:Application>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to