This content has been marked as final. Show 4 replies
I'm trying to do the same thing. I want to allow tree nodes to be re-order by dragging and dropping but I do not what to allow tree nodes to be placed in what ever order the users wants.
For example I do not want to allow a tree node to be dropped into the same tree level as the root tree node.
I may have figured the answer out however it would be using the Spring Loaded Tree developed by Jason Hawryluk, you can check it out here http://flexibleexperiments.wordpress.com/2007/02/26/flex-201-tree-with-spring-loaded-folde rs-update-2/. However it does not work in Flex 3 projects, only 2.0.1 which doesn't really help me at all, the way you would do it is have acceptDrag and acceptDrop properties on your collection. I've left a comment and emailed the guy so if anything ever comes of it I'll update this post.
Try using "event.preventDefault();" in your onDragOver() function when you want to cancel the drag drop. It seems to be working for me.
That works with a normal tree however it does not seem to work with the SpringLoadedTree which unfortunately has some features within it that I need to retain otherwise I would switch back to a normal Tree.