1 Reply Latest reply on Mar 8, 2010 12:09 PM by Flex harUI

    Drag from vbox to list??

    gcatcher Level 1

      Hey all,

       

      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:Script>
              <![CDATA[
                 
              ]]>
          </mx:Script>
         
          <mx:HBox>
              <mx:VBox width="250">
                  <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:VBox>
             
              <mx:List width="250" height="250"/>
          </mx:HBox>
      </mx:Application>

       

       

       

      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