I got this working, but if it doesnt use the builtin events when i
drop it. I just disapear with the items i'm dragging.
I don't want to create new function to the drop event, i want to use
the builtin one. Any idea why?!
Alex, anything you can help me with this code so i can keep using the
builtin dragdrop events and just specify the list i want to interact?
DragManager.showFeedback(DragManager.MOVE) doesn't seem to be working
if you don't put the DragManager in the Enter event.
=/
var dumm:ArrayCollection = new ArrayCollection(['Test1','Test2','Test3']);
var hhbox:HBox = new HBox();
hhbox.percentWidth = 100;
var list1:List = new List();
list1.percentWidth = 50;
list1.dataProvider = dumm;
list1.allowMultipleSelection = true;
list1.dropEnabled = false;
list1.dragEnabled = true;
list1.dragMoveEnabled = true;
list1.setStyle("alternatingItemColors",["#FFFFFF", "#EEEEEE"]);
list1.name = value.fieldname + '_source';
list1.id = value.fieldname + '_source';
list1.addEventListener(DragEvent.DRAG_ENTER,function(e:DragEvent):void {
DragManager.acceptDragDrop(UIComponent(e.currentTarget));
});
list1.addEventListener(DragEvent.DRAG_OVER,function(e:DragEvent):void
{
if (e.target.id == List(e.dragInitiator).id + '_source') {
DragManager.showFeedback(DragManager.MOVE);
} else {
DragManager.showFeedback(DragManager.NONE);
return;
}
});
var list2:List = new List();
list2.percentWidth = 50;
list2.dataProvider = new ArrayCollection();
list2.allowMultipleSelection = true;
list2.dropEnabled = false;
list2.dragEnabled = true;
list2.dragMoveEnabled = true;
list2.setStyle("alternatingItemColors",["#FFFFFF", "#EEEEEE"]);
list2.name = value.fieldname;
list2.id = value.fieldname;
list2.addEventListener(DragEvent.DRAG_ENTER,function(e:DragEvent):void {
DragManager.acceptDragDrop(UIComponent(e.currentTarget));
});
list2.addEventListener(DragEvent.DRAG_OVER,function(e:DragEvent):void
{
if (e.target.id == List(e.dragInitiator).id.replace('_source','')) {
DragManager.showFeedback(DragManager.MOVE);
} else {
DragManager.showFeedback(DragManager.NONE);
return;
}
});
hhbox.addChild(list1);
hhbox.addChild(list2);
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> dragInitiator in the dragEvent
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Rafael Faria
> Sent: Sunday, August 03, 2008 7:57 PM
> To: [email protected]
> Subject: [flexcoders] Multiple Lists
>
>
>
> I have multiple lists and i want one drag to another.
>
> The drag and drop is already working. My problem is that i have like
> 10 lists and any of them can drag to any other.
>
> Is there an easy way to set what list it can come from?
>
> like
>
> list1 can just receive dragable item from list2 and vice-versa.
>
> list3 can jusst receive from list4 and vice-versa.
>
> list5 from list6.
>
> and so on.
>
> What is the best way to work with drag and drop between lists? the
> native one or using the dragmanager?
>
> Thanks :p
>