1 Reply Latest reply on Jan 25, 2010 5:18 AM by seRajan

    Drag and Drop images

    venkateshk

      Please help me..

      my screen having 2 parts

      I have VBox,HBox as containers includes many images at left side

      and many boxes are there at right side

      I want to drag image to any of the given boxes at right side

        • 1. Re: Drag and Drop images
          seRajan

          Please check this example.

           

          http://livedocs.adobe.com/flex/3/html/help.html?content=dragdrop_7.html

           

          need to do some changes.

           

          Currently current container and drop container are same. We should chage the

           

           dragEnter="dragEnterHandler(event);" 
                  dragDrop="dragDropHandler(event);">

          into target conttainer.




                     private function dragDropHandler(event:DragEvent):void {
                          Image(event.dragInitiator).x =
                              Canvas(event.currentTarget).mouseX;
                          Image(event.dragInitiator).y =
                              Canvas(event.currentTarget).mouseY;
                      }

          change into

                     private function dragDropHandler(event:DragEvent):void {
                         targetContainer.addChild(Image(event.dragInitiator));
                      }

          1 person found this helpful