0 Replies Latest reply: Jan 29, 2013 10:17 PM by KentWood2012 RSS

    dragDrop can't work with Group?

    KentWood2012
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                       xmlns:s="library://ns.adobe.com/flex/spark" 
                                       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
                <fx:Script>
                          <![CDATA[
                                    import mx.core.DragSource;
                                    import mx.events.DragEvent;
                                    import mx.managers.DragManager;
      
                                    protected function group1_dragDropHandler(event:DragEvent):void
                                    {
                                              trace("worked!!!")
                                    }
      
                                    protected function image1_mouseDownHandler(event:MouseEvent):void
                                    {
                                              DragManager.doDrag(event.currentTarget,new DragSource,event);
                                    }
      
                                    protected function group1_dragEnterHandler(event:DragEvent):void
                                    {
                                              DragManager.acceptDragDrop(event.dragInitiator);
                                    }
      
                          ]]>
                </fx:Script>
                <s:Group dragDrop="group1_dragDropHandler(event)" dragEnter="group1_dragEnterHandler(event)" width="100" height="100">
                          <s:Rect width="100%" height="100%">
                                    <s:fill>
                                              <s:SolidColor color="0" />
                                    </s:fill>
                          </s:Rect>
                </s:Group>
                <s:Image x="300" y="300" source="test.jpg" mouseDown="image1_mouseDownHandler(event)" />
      </s:Application>
      
      

      here is my app code,my amigo,i dunno why Group cant capture dragdrop event,do u know?

       

       

       

      =============================================================

      so stupid i am!

      DragManager.acceptDragDrop(event.dragInitiator);

      it's wrong.it should be like this

      DragManager.acceptDragDrop(event.target);

      then everything is ok now