Hi all, Am new to flex. Was learning with examples given in flex3 livedoc.

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

There i came across this drag and drop example.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>

   <mx:Script>
       <![CDATA[
           //Import classes so you don't have to use full names.
           import mx.managers.DragManager;
           import mx.core.DragSource;
           import mx.events.DragEvent;
           import flash.events.MouseEvent;

           // Embed icon image.
           [Embed(source='assets/globe.jpg')]
           public var globeImage:Class;

           // The mouseMove event handler for the Image control
           // initiates the drag-and-drop operation.
           private function mouseMoveHandler(event:MouseEvent):void
           {
               var dragInitiator:Image=Image(event.currentTarget);
               var ds:DragSource = new DragSource();
               ds.addData(dragInitiator, "img");

               DragManager.doDrag(dragInitiator, ds, event);
           }

           // The dragEnter event handler for the Canvas container
           // enables dropping.
           private function dragEnterHandler(event:DragEvent):void {
               if (event.dragSource.hasFormat("img"))
               {
                   DragManager.acceptDragDrop(Canvas(event.currentTarget));
               }
           }

           // The dragDrop event handler for the Canvas container
           // sets the Image control's position by
           // "dropping" it in its new location.
           private function dragDropHandler(event:DragEvent):void {
               Image(event.dragInitiator).x =
                   Canvas(event.currentTarget).mouseX;
               Image(event.dragInitiator).y =
                   Canvas(event.currentTarget).mouseY;
           }
       ]]>
   </mx:Script>

   <!-- The Canvas is the drag target -->
   <mx:Canvas id="v1"
       width="500" height="500"
       borderStyle="solid"
       backgroundColor="#DDDDDD"
       dragEnter="dragEnterHandler(event);"
       dragDrop="dragDropHandler(event);">

       <!-- The image is the drag initiator. -->
       <mx:Image id="myimg"
           source="@Embed(source='assets/globe.jpg')"
           mouseMove="mouseMoveHandler(event);"/>
   </mx:Canvas>
</mx:Application>


here to set drag initiator ,  Canvas(event.currentTarget).mouseX;
this x will be  the x during mouse button release .

 Instead , I want the x and y of the
shadow of the image (ie the border  of the image). How will i set it?
Please help.
-- 
View this message in context: 
http://www.nabble.com/Drag-and-drop-tp24567297p24567297.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to