Try using dropNode = dest.getDropParent().getTreeNodeAt(dropLoc)
.
Matt
From: dustin_speer
[mailto:[EMAIL PROTECTED]
Sent: Monday, February 28, 2005
3:55 PM
To: [EMAIL PROTECTED]
Subject: [flexcoders] Drag and
Drop with Tree
I am doing a drag and drop from a TileList into a
Tree. I don't want
to insert the object from the tile list intothe
Tree, just want to
kick off an event based on whatever item in the
tree the object was
dragged onto. The only problem is that it doesn't
seem to be
accessing the elements of the Tree correctly. I
have a tree set up
like:
-Group 1
-Group 1 Subgroup 1
-Group 1 Subgroup 2
-Group 1 Subgroup 3
-Group 2
-Group 2 Subgroup 1
-Group 2 Subgroup 1
Whenever I drop the object on top of an itemin
group 1, it works
properly. However, whenever I drop it on an item
in group 2, it still
references an object in group 1. Any thoughts?
Here is my drag and
drop code:
import mx.managers.DragManager;
function doDragEnter(event)
{
event.handled="true";
}
function doDragExit(event)
{
event.target.hideDropFeedback();
}
function doDragOver(event)
{
event.target.showDropFeedback();
if
(Key.isDown(Key.CONTROL))
event.action = "">
else
event.action = "">
}
function doDragDrop(event)
{
doDragExit(event);
var dest =
event.target;
var dropLoc =
dest.getDropLocation();
var dropNode = groups.getItemAt(dropLoc);
mx.controls.Alert.show(dropNode.attributes.label, "DAM
Mistake");
//var item =
event.dragSource.dataForFormat("object");
//ws.AddItemToGroup(item.aID,)
//cart.addItem({Name: item.aName, ID: item.aID});
}
function doDragComplete(event)
{
doDragExit(event);
}
|