HI,

Please Replace following code
--------
   <!-- The Text control is the drag initiator and the drag proxy. --
>
   <mx:TextInput id="mytext" text="abc" mouseMove="mouseOverHandler
(event);" dragComplete="dragCompleteHandler(event);"/>
   </mx:Canvas>
======
with
=====
   <!-- The Text control is the drag initiator and the drag proxy. -->
   <mx:TextInput id="mytext" text="abc" mouseMove="mouseOverHandler
(event);" dragComplete="dragCompleteHandler(event);"/>
   </mx:Canvas>

----------------------
Regards,
Jaydeep Tank

On Tue, Dec 2, 2008 at 11:54 AM, subha <[EMAIL PROTECTED]> wrote:

>
> Hi,
> I want to drag text from one text input field and drop it in other
> text input field..
> i can drag text from input field but not able to paste in textInput
> field.. anyone help me
>
> <?xml version="1.0"?>
> <!-- dragdrop\DandDImageCopyMove.mxml -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>    layout="horizontal">
>
>    <mx:Script>
>        <![CDATA[
>                import mx.controls.TextInput;
>                import mx.controls.Text;
>            import mx.managers.DragManager;
>            import mx.core.DragSource;
>            import mx.events.DragEvent;
>            import flash.events.MouseEvent;
>
>            public var globeText:String;
>
>            private function mouseOverHandler(event:MouseEvent):void
>            {
>                var dragInitiator:TextInput=TextInput
> (event.currentTarget);
>                var ds:DragSource = new DragSource();
>                ds.addData(dragInitiator, "txt");
>                var TextProxy:TextInput = new TextInput();
>                TextProxy.text = globeText;
>                TextProxy.height=10;
>                TextProxy.width=10;
>                DragManager.doDrag(dragInitiator, ds, event,
>                    TextProxy, -15, -15, 1.00);
>            }
>
>            private function dragEnterHandler(event:DragEvent):void {
>              if (event.dragSource.hasFormat("txt"))
>                DragManager.acceptDragDrop(Canvas
> (event.currentTarget));
>            }
>            private function dragOverHandler(event:DragEvent):void
>            {
>                if (event.dragSource.hasFormat("txt")) {
>                    if (event.ctrlKey) {
>                        DragManager.showFeedback(DragManager.COPY);
>                        return;
>                    }
>                    else {
>                        DragManager.showFeedback(DragManager.MOVE);
>                        return;
>                    }
>                }
>
>                DragManager.showFeedback(DragManager.NONE);
>            }
>
>            private function dragDropHandler(event:DragEvent):void {
>              if (event.dragSource.hasFormat("txt")) {
>                  var draggedText:TextInput =
>                    event.dragSource.dataForFormat('txt') as
> TextInput;
>                  var dropCanvas:Canvas = event.currentTarget as
> Canvas;
>                  var newText:Text=new Text();
>                  newText.text = draggedText.text;
>                  newText.x = dropCanvas.mouseX;
>                  newText.y = dropCanvas.mouseY;
>                  dropCanvas.addChild(newText);
>              }
>            }
>
>            private function dragCompleteHandler(event:DragEvent):void
> {
>                var draggedText:TextInput =
>                    event.dragInitiator as TextInput;
>                var dragInitCanvas:Canvas =
>                    event.dragInitiator.parent as Canvas;
>
>                if (event.action == DragManager.MOVE)
>                    dragInitCanvas.removeChild(draggedText);
>            }
>        ]]>
>    </mx:Script>
>  <!-- Canvas holding the Text control that is the drag initiator. -->
>    <mx:Canvas
>        width="250" height="500"
>        borderStyle="solid"
>        backgroundColor="#DDDDDD">
>
>    <!-- The Text control is the drag initiator and the drag proxy. --
> >
>    <mx:TextInput id="mytext" text="abc" mouseMove="mouseOverHandler
> (event);" dragComplete="dragCompleteHandler(event);"/>
>    </mx:Canvas>
>
>    <!-- This Canvas is the drop target. -->
>    <mx:Canvas
>        width="250" height="500"
>        borderStyle="solid"
>        backgroundColor="#DDDDDD"
>        dragEnter="dragEnterHandler(event);"
>        dragOver="dragOverHandler(event);"
>        dragDrop="dragDropHandler(event);" >
>    </mx:Canvas>
> </mx:Application>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to