views:

23

answers:

1

Hi -

How do I prevent a user from dropping an item outsider a folder? My dataProvider is only 1-level deep.

It seems that with a DragEvent handler or DragDrop handler I can find the data of the item I'm dragging, but not where I'm dropping ( so I can prevent it ).

The Tree has been giving me such problems all last week. Any helpful tips would be really appreciated.

Thanks!

A: 

I found a work-around, although it doesn't allow me to visually prevent a drop. I leave the dragEnabled and dropEnabled properties of the Tree to true and I check for null in the _dropData.parent property in the dragDrop event. For now, this works.

use namespace mx_internal; var dropData:Object = this.marksTree.mx_internal::_dropData;

if( dropData.parent == null ){
 event.preventDefault();
 this.marksTree.hideDropFeedback(event);
 return;
}

It's very tricky working with the Tree. I hope at some point they expose the dropData property a little more clearly.

I hope this helps someone.

fumeng