Hi. I want to use drag and drop from one panel which contains a titlewindow to another panel. What i can do is to deplace it. But what i want to do is to copy it not move it This is my code
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();" > <mx:Panel x="47" y="78" width="200" height="200" backgroundColor="#FFFFFF" layout="absolute" id="pan1" > <mx:TitleWindow x="10" y="10" label="Button" mouseMove="mouseOverHandler(event);" width="160" backgroundColor="#F60B0B" height="77"> </mx:TitleWindow> <mx:Button x="40" y="118" label="Button2"/> </mx:Panel> <mx:Panel x="460" y="78" width="200" height="200" backgroundColor="#FFFFFF" dragDrop="dragDropHandler(event)" id="pan2" dragEnter="dragEnterHandler(event)"> </mx:Panel> <mx:Script> <![CDATA[ import mx.events.CloseEvent; import mx.containers.TitleWindow; import mx.managers.DragManager; import mx.core.DragSource; import mx.events.DragEvent; import mx.containers.Canvas; public function init():void { DragManager.showFeedback(DragManager.COPY); } private function mouseOverHandler(event:MouseEvent):void { var dragInitiator:TitleWindow = event.currentTarget as TitleWindow; var ds:DragSource= new DragSource(); ds.addData(dragInitiator, "can"); var imageProxy:TitleWindow = new TitleWindow(); DragManager.doDrag(dragInitiator, ds, event, imageProxy); } private function dragEnterHandler(event:DragEvent):void { if (event.dragSource.hasFormat("can")) { event.preventDefault(); DragManager.acceptDragDrop(pan2); } } private function dragDropHandler(event:DragEvent):void { var window:TitleWindow= event.dragInitiator as TitleWindow; window.x = 10; window.y = 10; window.showCloseButton=true; window.addEventListener(CloseEvent.CLOSE, fermer_h) pan2.addChild(window); trace(DragManager.getFeedback()); } public function fermer_h(event:CloseEvent):void { pan2.removeChild(TitleWindow(event.currentTarget)); } ]]> </mx:Script> </mx:Application> -- View this message in context: http://www.nabble.com/Problem-drag-and-drop-tp22997154p22997154.html Sent from the FlexCoders mailing list archive at Nabble.com.

