Yves, THANK YOU , THANK YOU , THANK YOU... life is good. Worked like
a champ. I had never done the mx_internal piece, great pointer thank
you very much.
Here is a sample of the function I created, David I hope this helps:
private function dropData( event:DragEvent ) : void
{
var parent:String =
event.dragInitiator.mx_internal::_dropData.parent.label;
var childParent:String = item.parentComp;
if(parent == "BOXC"){
trace("moved through the match");
}else{
event.preventDefault();
trace("moved out of the match");
}
}
Put this in your import statement area:
import mx.core.mx_internal;
use namespace mx_internal;
Thanks again Yves!
--- In [email protected], "Yves Riel" <r...@...> wrote:
>
> When a drag & drop operation occurs on a tree, the drag & drop handlers
> call the public calculateDropIndex() function. This function stores all
> the properties that you want in an mx_internal variable called _dropData
> of Object data type.
>
> So, make sure that your class import and use the mx_internal namespace
> and attach a listener to the tree's dragDrop event. In the event
> handler, look up the _dropData variable and specifically the "parent"
> and "index" properties. If this drop operation should not be allowed,
> call the preventDefault() method on the event.
>
> That should do the trick.
>
> ________________________________
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of David Kramer
> Sent: Monday, February 02, 2009 12:34 PM
> To: [email protected]
> Subject: RE: [flexcoders] Tree Control Drag and Drop Help
>
>
>
> Adrian,
>
> I am up against the same problem. Please share your knowledge on it so
> far. kramer.da...@... <mailto:kramer.da...@...>
>
> Many thanks.
>
> David
>
> ________________________________
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of adrianpomilio
> Sent: Monday, February 02, 2009 8:45 AM
> To: [email protected]
> Subject: [flexcoders] Tree Control Drag and Drop Help
>
>
>
> This is a two part question.
>
> 1 - How can I keep a child from being dropped outside of it's parent?
> I want to be able to drag and drop within a nodes parent.
>
> 2 - How do I get a handle on the new index of the node that has been
> dropped.
>
> I can get the current index, the parents name, but not the location it
> was dropped.
>
> I am using an ArrayCollection to populate the tree, using the children
> attribute to create the child nodes. I am stuck with having to use
> the ArrayCollection.
>
> Any pointers would be great.
>