3 Replies Latest reply on Jan 8, 2007 1:22 PM by dimival

    Cancel Drag/Drop Operation

      Is there a way to cleanly cancel a drag/drop operation. I want to cancel it by hitting the escape key. I can capture the Escape key being hit during the drag/drop I don't know how to make the Image proxy go away and return to it's source.

      Thanks in advance!
        • 1. Re: Cancel Drag/Drop Operation
          dimival Level 1
          I had a similar issue, but what i wanted was to return DataGrids to their normal state so i used this method:

          event.preventDefault() //where event is the DragDropEvent

          This one prevents the Drag n Drop event from continuing, i think it might also remove the proxy image, so try it out

          Hope this helps
          • 2. Re: Cancel Drag/Drop Operation
            tnirenstein Level 1
            Thanks for the reply but could you clarify a little? I tried putting e.preventDefault() in the handler method for a DragDrop operation and it still performs the operation. Was that what you were suggesting or did I misunderstand?

            • 3. Re: Cancel Drag/Drop Operation
              dimival Level 1
              I have this:

              <mx:DataGrid dragDrop="customDragDrop(event)" >

              private function customDragDrop(event : DragEvent) : void
              event.preventDefault(); // 1
              //own Drag n Drop logic // 2
              event.currentTarget.hideDropFeedback(event); //3

              As you can see i am calling a function on the dragDrop event of the Datagrid and
              1. i am preventing it from doing what it normally does
              2. do my own drag and drop logic
              3. restore the DataGrid to a normal state

              preventDefault() as the name implies, prevents the event from doing it's normal routine