So it is a bug, http://bugs.adobe.com/jira/browse/SDK-13227. This 
seems quite impossible to workaround, as you can't capture any drop 
location positioning information about the item being 
dragged/dropped. Any ideas?

JF
--- In flexcoders@yahoogroups.com, "jmfillman" <[EMAIL PROTECTED]> wrote:
>
> This is a little complicated to explain, so please bear with me. 
Run 
> the example AIR app below, drag the button to see what happens, and 
> then read on. 
> 
> I can't seem to calculate the place where the item was actually 
> dropped in the Canvas?
> I tried calculate the position in the dragDropHandler based on the 
> canvas mouseY + verticalScrollPosition, but the mouseY position 
value 
> oddly gets fixed to the mouse position where the drag started, not 
> the current mouseY position.
> 
> Is this a bug?
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"; 
> layout="absolute" initialize="initApp();">
>       <mx:Script>
>               <![CDATA[
>                       import mx.controls.Button;
>                       
>                       import mx.events.DragEvent;
>                       import mx.core.DragSource;
>                       import mx.managers.DragManager;
>               
>                       private function initApp():void{
>                               maximize();
>                               var myButton:Button = new Button;
>                               myButton.y = 1355;
>                               myButton.x = 60;
>                               myButton.label = "Drag Me";
>                               myButton.addEventListener
> (MouseEvent.MOUSE_MOVE, mouseMoveHandler,false,0,true);
>                               myDropCanvas.addChild(myButton);
>                               myDropCanvas.verticalScrollPosition = 
> 1255;
>                       }
>                       private function mouseMoveHandler
> (event:MouseEvent):void {
>                               if (event.currentTarget is Button){
>                                       var myProxy:Button = 
> event.currentTarget as Button
>                                       var 
> dragInitiator:Button=Button(event.currentTarget);
>                                       var ds:DragSource = new 
> DragSource();
>                                       ds.addData
> (dragInitiator,"dragAppt");
>                                       DragManager.doDrag
> (dragInitiator, ds, event, myProxy, 0, 0,1.0,true);
>                                       txtDragMouseY.text = 
> myDropCanvas.mouseY.toString();
>                               }
>                               trace ("Mouse Move Trace: " + 
> myDropCanvas.mouseY);
>                       }
>                       private function dragEnterHandler
> (event:DragEvent):void{
>                       if (event.dragSource.hasFormat("dragAppt"))
>                       {
>                           DragManager.acceptDragDrop(Canvas
> (event.currentTarget));
>                       }
>                       }
>                       
>                       private function dragDropHandler
> (event:DragEvent):void{
>                       Button(event.dragInitiator).y = Canvas
> (event.currentTarget).mouseY; 
>                       trace ("Drag Drop Trace: " + 
> myDropCanvas.mouseY);                                 
>                       }
>               ]]>
>       </mx:Script>
>       <mx:Canvas id="myDropCanvas" top="5" bottom="0" width="100%" 
> verticalScrollPolicy="on" dragEnter="dragEnterHandler(event);" 
> dragDrop="dragDropHandler(event);" click="trace (stage.mouseY);" 
> left="180">
>               <mx:VRule left="53" top="16" width="5" height="2875" 
> styleName="gridVerticalLines"/>
>       </mx:Canvas>
>       <mx:Label x="0" y="10" text="Canvas Mouse Y During Drag" 
> fontWeight="bold"/>
>       <mx:Text left="10" top="36" id="txtDragMouseY"/>
> </mx:WindowedApplication>
>


Reply via email to