1 Reply Latest reply on Jul 1, 2009 3:16 PM by *Prashant Shelke*

    Drag and Drop with multiple lists

    accyboy Level 1



      I'm new to Flex development and having trouble with a particular problem.


      I'm after placing 4 lists on a particular form and allowing drag and drop on each list. However list one can only drag onto list two and vice versa and list three can only drop onto list four and vice versa. My problem is that I cant figure out how to limit what each list can accept from other lists. I've tried created dragEnter and dragDrop events but am having difficulties. Any help would be much appreciated.




        • 1. Re: Drag and Drop with multiple lists
          *Prashant Shelke* Level 4

          <mx:List id="listTotalsBy" dragEnter="doDragEnter(event);" mouseDown="setDragInitator(event, 'listTotalsBy');"   />

          private var dropInitiator:String

          public function setDragInitator(event:MouseEvent, id:String):void
              dropInitiator = id;

          * this method will call while drag & drop will start & used to set initial parameters for drag & drop
          * activity.
          public function doDragEnter(event:DragEvent):void
                  var dropTarget:List = List(event.currentTarget);
                  if(dropInitiator == "listTotalsBy" && (dropTarget.id == "listSelectedTotalsBy" || dropTarget.id == "listTotalsBy" ))/*here u can make a choice*/

              catch(error :Error)
                  Alert.show("error : " + error.getStackTrace());