I've been having a heck of a time trying to get this to work, basically I have a list of components on one panel in a vbox, and I want to drag them into a list on the right panel.
How do I tell the list to accept a drag drop action coming from a vbox? I've looked at dozens of examples online that display list-list, vbox-vbox, list-image but nothing that is vbox-list.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Canvas id="redSquare" width="25" height="25" backgroundColor="Red"/>
<mx:Canvas id="blueSquare" width="25" height="25" backgroundColor="Blue"/>
<mx:Canvas id="greenSquare" width="25" height="25" backgroundColor="Green"/>
<mx:Canvas id="yellowSquare" width="25" height="25" backgroundColor="Yellow"/>
<mx:List width="250" height="250"/>
In the example above I want the user to drag any number of red/blue/green/yellow squares into the list. They could re-order or remove those items as well. So, for a usecase the user should be able to drag in 5 instances of the red square, 3 instances of the blue square and so on.
Why not make it list to list?
The end result is much more complicated then this. There are dozens of different options and when they drag in an item it will prompt them for custom input depending on which item they dragged in from. I'm also confused as to why this has to be so difficult, what am I missing?
Any help would be appreciated
If you have a vbox-vbox example, then try adding an "items" format to the
DragSource where items is an array of objects that will match what gets
dropped into the destination List's dataprovider.