2 Replies Latest reply on Sep 14, 2009 6:33 AM by pyso

    D&D with two items concurently

    pyso Level 1

      Hi all,

      is there any posibility to do D&D for two items concurently? I mean that I have two Canvas objects and I want to move with them concurently when I am moving with mouse.

       

      I have such a code where c1 and c2 are Canvas objects. I thought it would work but the result is that moving canvas is only c1.

      private function mouseMoveHandler(event:MouseEvent):void
              {
                  var dragInitiator1:Canvas=c1;
                  var ds1:DragSource = new DragSource();
                  DragManager.doDrag(dragInitiator1, ds1, event);
                 
                  var dragInitiator2:Canvas=c2;
                  var ds2:DragSource = new DragSource();
                  DragManager.doDrag(dragInitiator2, ds2, event);               
              }

       

      So what's wrong with this? How should I do it?

       

      //pyso

        • 1. Re: D&D with two items concurently
          salem_b_a Level 2

          i think the problem here is that the event is dispatched only for the first doDrag because her it is a serial execution of instructions

          try to split  the two drags into two separate functions, mouseMoveHandler1 and mouseMoveHandler2 and then dispatch them from the event!

          please let me know if that works

           

           

          Regards,

          Ben Afia Salem

          salemba@live.fr

          • 2. Re: D&D with two items concurently
            pyso Level 1

            Hi, thanks for your idea but it didn't help me.

            Actualy I have Canvas with lets say 10 of Images. User select some of them by clicking on them. There is shown highlight frame around each of them. And now if user click on one of those I need to do D&D with all of them.

            Perhaps it could be done via setting proxy image which would show them during moving with mouse cursor but I am not so sure if it's the right approach.

             

            //pyso