You'll probably have to call preventDefault() in each of your handlers.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of g07m5064
Sent: Monday, October 22, 2007 4:16 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Drag and drop

 

I have made the call in the dropHandler function. At this point, I
think the problem lies with the dragEnterHandler function.
Thanks
--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Usually you have to call preventDefault() so the underlying component
> does not execute its default behavior.
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of g07m5064
> Sent: Monday, October 22, 2007 1:46 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Drag and drop
> 
> 
> 
> 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,'st
> ringFormat')"/>
>

 

Reply via email to