Hi All,

I have a tree component that supports drag and drop. However, I need to
prevent the EU from dropping into a specific node. I would like to display
the "red x" indicator over this specific node and have the drop rejected.

I first tried to get this to work in my DragEnter event handler and not
accepting the dragDrop if the target item was one of these specific nodes
but would only work if I entered over the specific item and I need it to
update as the EU drags over the items in the tree. My next attempt after
reading some posts was to toggle the tree.dropEnabled property in my
DragOver event handler, I have been able to get it to work... but I cant
figure out why, this is my code:

*****Drag Over logic****

var dropTarget:Tree = Tree(dragEvent.currentTarget);
var targetItemIndex:int = dropTarget.calculateDropIndex( dragEvent );
var item:Object = dropTarget.getItemAtIndex( targetItemIndex );

//This logic is wrong as it should be dropTarget.dropEnabled = (item is
CustomClass && !CustomClass(item).isDropDisabled).
//But with the right logic every node that drop is enabled for shows the
'red x' and drops are rejected and the one that is disabled accepts drops
dropTarget.dropEnabled = (item is CustomClass &&
CustomClass(item).isDropDisabled);

DragManager.showFeedback( DragManager.NONE );

****End Drag Over logic.*****

While debugging I can confirm that my item.isDropDisabled is returning the
correct value. So why is it working... One other thing I can confirm is that
it does depend on me updating the DragManager.showFeedback as if I omit that
call the indicator does not show the 'red x' and reject the drop.

Does anyone know why this is working or how I should do it properly?

Any help much appreciated.

Greg

Reply via email to