2 Replies Latest reply on Dec 15, 2009 1:45 PM by SpaghettiCoder

    Drag and Drop

    SpaghettiCoder Level 3

      Currently working with Drag and Drop from two tile lists.

       

      (1) Is it possible to make some objects in a tile list dragEnabled and others not dragEnabled? right now it seems i can only make all objects in the tilelist dragEnabled or not dragEnabledmoveable rather than set it individually.

       

      (2) When you disable dropEnabled on a tilelist, it prevents objects from another tilelist to drop into it, but this also seems to prevent you from re-arranging the objects that are in that tilelist as well, I don't want other objects dropping into it, but I still want to be able to re-arrange what's currently in the tilelist.

       

      Has anyone done anything similar, I don't need actualy code, probably some direction or guidance would be fine.

        • 1. Re: Drag and Drop
          PhilipKeiter Level 2

          SpaghettiCoder,

           

          Listen to the dragOver and dragDrop events. You can usually use the same handler for both. Inside the handler, you can check if you want to allow it or not by checking the various parts involved. You can use event.currentTarget to determine what list is the target of the drag/drop. You can use event.dragSource.dataForFormat() do find out the data inside what is being dragged. If based on those two pieces of information, it should not be enabled, call:

           

          DragManager.showFeedback(DragManager.NONE);

          list.hideDropFeedback(event);

          event.preventDefault();

           

          Oh and make sure in your handler you type the event as event:DragEvent not event:Event

           

          Hope that helps!
          Thanks,
          Philip
          • 2. Re: Drag and Drop
            SpaghettiCoder Level 3

            Thanks, your suggestions got me on the right track and pretty much did the trick.

             

            DRAG_OVER didn't work, but DRAG_ENTER did.