2 Replies Latest reply on Oct 27, 2009 12:19 PM by steveo de stevelux

    Reordering drag drop with manual application

    steveo de stevelux

      Here's some pseudo MXML of what I'm dealing with:

       

      <vbox id=1>

           <box/>

           <box/>

           <box/>

      </vbox>

       

      <vbox id=2>

           <box/>

      </vbox>

       

      I've applied manual drag event listeners to everyone and can easily drag and drop from one vbox to another. Where it goes awry is when I try to reorder the boxes. What happens is the vbox container picks up all the drag events (enter,over,etc) but none of the children do. I know a lot of the canned components like list and datagrid allow for reordering but for some reason this manual approach (which is necessary) isn't working.

       

      I've tried adding mouseEnabled=true on all the boxes to no avail. I've spent a day scouring forums and documentation to no avail.

       

      Any direction someone could point me in would be very beneficial.

        • 1. Re: Reordering drag drop with manual application
          steveo de stevelux Level 1

          Kind of a bump, but worth adding - Ever since ActionScript 2 in Flash you've had something called a hitTest that allows you to basically do collision logic. So, if I drag one of my child <mx:Box> items around I can have a logic trap that says: 1. Which <mx:Vbox> parent container does this hitTest belong to? 2. Which child <mx:Box> does the freshly dropped <mx:Box> have a positive hitTest on. In that sense you can figure out what the user intended to do based on who he's dropping things on (or she of course).

           

          Whats missing from the built in FLEX Drag classes (at least that I've found so far) is the ability to do collision detection not only on the parent container but with the child elements inside  that container. Right now, it blocks ANY flavor of the drag and drop events to child objects. I'm not sure if that's bubbling, is it? Either way. I can do it the old way with hitTest collision checks but I'm sooooo close to being able to use the native DragEvents. Plus, that means I'll  have to write a class to handle data arrays being moved from one place to another which is just duplicating what's "almost perfect".

           

          Just point me in a direction guys, anything is better than the brick wall I'm stuck behind right  now.

          • 2. Re: Reordering drag drop with manual application
            steveo de stevelux Level 1

            I've had to write my own drag/drop class sadly.

             

            I never figured out a way to be able to tweak bubbling (is it?) on

            the needed events.

             

            If it's possible I couldn't figure out how, nor could I find an example

            of how to keep have child listeners to fire.

             

            The container event is opaque and allows no child events to

            bubble up best I could tell.