I use the dropEnabled setting, but in all of the handlers, I call
event.preventDefault();  Then I test the source and target and call
DragManager.showFeedback(), DragManager.acceptDragDrop() conditionally
as required.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Pan Troglodytes
Sent: Tuesday, September 16, 2008 11:20 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Drag and Drop question

 

I believe you're going to need to handle the drop events yourself and
not use the dropEnabled=true setting.  When you do that, by default drop
is denied and you have to tell it to allow it, like in the dragEnter
event.  For example:

private function dragEnterHandler(e:DragEvent):void
{
  DragManager.acceptDragDrop(UIComponent(e.currentTarget));
  DragManager.showFeedback(DragManager.COPY);
}



On Tue, Sep 16, 2008 at 9:59 AM, zootpeet <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

I am trying to implement drag and drop onto a tree. In the dropDrop
handler, I want to be able to deny the drop from happening, based on
which element of the tree is being dropped on. 

// r is the visible index in the tree
var dropTarget:Tree = Tree(event.currentTarget);
var r:int = dropTarget.calculateDropIndex(event);
dstXmlTree.selectedIndex = r;
var node:XML = dstXmlTree.selectedItem as XML;

if (node.toXMLSting == "whatever") {
// Allow drop -- HOW?
} else {
// Do NOT allow drop -- HOW?
}

How do I deny the drop?

thanks!




-- 
Jason

 

Reply via email to