1 Reply Latest reply on Jan 7, 2010 2:54 PM by Jason Szeto

    drop on list items

    Harbs. Level 6

      Here is a screenshot of two Lists I have created:



      The dataProvider of the "Glyph Sequences" List is nested within that of the "Glyph tables" list.


      Here's the basic structure of the data:

      <tables counter="6">

      <table label="Table 1" tableID="-40424819" counter="6">

        <sequence label="Sequence 1"/>

        <sequence label="Sequence 2"/>

        <sequence label="Sequence 3"/>

        <sequence label="Sequence 4"/>

        <sequence label="Sequence 5"/>

        <sequence label="Sequence 6"/>


      <table label="Table 2" tableID="-40424669" counter="0"/>

      <table label="Table 3" tableID="-40424520" counter="0"/>

      <table label="Table 4" tableID="-40424382" counter="0"/>

      <table label="Table 5" tableID="-40424132" counter="0"/>

      <table label="Table 6" tableID="-40423932" counter="0"/>



      Each of these Lists allow drag-drop. Normally the drag-drop of List items is limited to within that List to allow moving them to re-order the items within the structure. I use the following (very simple) dragEnter event handler to do that:


      private function limitDropToCurrent(event:DragEvent):void{

      if(event.dragInitiator != event.target){






      I need to add the ability to drop items from the "Glyph Sequences" List onto specific items within the "Glyph Tables" list and copy the data being dragged to that specific "table" (item within the "Table List").


      What would be the best way to go about this?




        • 1. Re: drop on list items
          Jason Szeto Level 3



          Each drag-drop operation has a DragSource object associated with it. You can populate this DragSource with whatever information you desire. If you subclass List and override addDragData, you can add your custom data to the DragSource. Then in your destination List, subclass it and override the dragEnterHandler and dragStartHandler to only allow a drop if it meets your requirements. To figure out what item has been dropped onto, you can use the ListBase.calculateDropIndex function.


          To change how the dropIndicator behaves and appears, override showDropFeedback. You'll probably want to change the default behavior which shows an insertion cursor.