2 Replies Latest reply on Jul 18, 2007 6:29 AM by bung33

    Creating Dynamic Controls with Drag-n-Drop

    bung33
      I'm creating an application that allows users to drag bubbles from a panel on the left and drop them on a central workspace. I've already coded the drag-n-drop operations for this process, and it all works just fine. The user can drag one bubble (which represents a category) and when dropped, a new similar control gets created at the mouse coordinates. However, what I can't figure out how to do is create that new control with dragEnter and dragDrop properties of it's own. Obviously, if I was creating this control ahead of time, then I would specify those events in the XML portion, but I'm creating the control dynamically, so I have to figure out some way to set that up. Something like...

      var newBubble:Canvas = new Canvas();

      newBubble.height = 50;
      newBubble.width = 100;
      newBubble.x = target.mouseX - xOffset;
      newBubble.y = target.mouseY - yOffset;

      newBubble.dragEnter = "doDragEnter()";
      newBubble.dragDrop = "doDragDrop()";

      However, when creating new controls, the dragEnter and dragDrop properties aren't available. Any suggestions as to how I can do this?