I was trying to implement drag and drop for a loaded Image today. All I needed to do was move it, and constrain the drag to the parent container, and that’s it. In two different books I have on flex, and in the documentation, as well as this tutorial, they talk about implementing drag and drap through a series of steps which include:
- importing the DragManager, Drag Source, and Drag Event classes
- Creating a new DragSource object
- Creating a new proxy image, which is the item that is visibly being dragged
- Setting up another object oto act as as a drop target and handle drag events
After getting 90% complete with that method, I ran across a comment on the Flex LiveDocs which pointed me to the blatantly obvious: you can simply use the startDrag() and stopDrag() methods inherited Sprite.
Durr.
I think generally from a Flash standpoint, people associate DnD as a set of features acted upon a movieClip exactly as your case. The DnD concept for Flex however means more of dropping data to and from list-based classes.
But to tell the truth, I went down that same avenue when I started getting into DnD. If you are interested in a concept much like the google personalized homepage widgets, I made a framework called UICDragNDrop. I don’t have it uploaded anywhere but I can certainly send you the code if you are interested.
j