Hi, I not sure what is missing on my code. In addition to dragging a
row from a datagrid to a listgrid I would like to have an image
dragged to the listgrid. I am able to drag the image. However my
dragEnter function is not working. I would appreciate any help you
offer. Thanks in advance.
Mathe
private function dropHandler(event:DragEvent,format:String):void                
var targetRow:Object = new Object();                                     var 
name:Object = new
Object();
         if (event.dragSource.dataForFormat("items"))
         {
         targetRow = event.dragSource.dataForFormat("items");                   
 
liTarget.dataProvider.addItem(targetRow[0].name);
         }
        else{
         name = event.dragSource.hasFormat(format);
         liTarget.dataProvider.addItem(name);
        } 
        event.preventDefault();
}
  private function mouseMoveHandler(initiator:Image,
name:String,event:MouseEvent,format:String):void  
         {
             var ds:DragSource = new DragSource();
             ds.addData(name,format);    
             DragManager.doDrag(initiator, ds, event);
          } 

private function dragEnterHandler(event:DragEvent, format:String):void {
     if (event.dragSource.hasFormat(format))
      {                  
DragManager.acceptDragDrop(IUIComponent(event.target));
       }
  }
<mx:List id="liTarget" dropEnabled="true"
dragDrop="dropHandler(event,'stringFormat')"                    
dragEnter="dragEnterHandler(event,'stringFormat')"
dataProvider="{top}" /> 
                
<mx:Image id="dragImage" source="assets/{dg.selectedItem.image}" 
mouseMove="mouseMoveHandler(dragImage,'{dg.selectedItem.name}',event,'stringFormat')"/>
                                    
                            

Reply via email to