flash - How would I create a panel on drag drop in flex 4? -
i trying drag component , on drop want create panel. here actionscript have doesn't seem working, ideas why?
private function dragdrop(e:dragevent): void { var userpanel:panel = new panel(); userpanel.width = 100; userpanel.height = 100; userpanel.x = 10; userpanel.y = 10; userpanel.visible = true; addchild(userpanel); }
the code you've included valid. drag initiator configured correctly? drop target configured accept drag-drop?
here's code add panel canvas1 when canvas2 dragged canvas1:
protected function canvas2_dragstarthandler(event:mouseevent):void { var draginitiator:canvas=canvas(event.currenttarget); var ds:dragsource = new dragsource(); dragmanager.dodrag(draginitiator, ds, event); } protected function canvas1_dragenterhandler(event:dragevent):void { dragmanager.acceptdragdrop(canvas(event.currenttarget)); } protected function canvas1_dragdrophandler(event:dragevent):void { var userpanel:panel = new panel(); userpanel.width = 100; userpanel.height = 100; userpanel.x = 10; userpanel.y = 10; userpanel.visible = true; canvas(event.currenttarget).addchild(userpanel); }
Comments
Post a Comment