6 Replies Latest reply on Jul 8, 2010 3:41 PM by UbuntuPenguin

    CollectionEvent MOVE


      Ok, I am confused and need help.


      I have a Flex 3 application with a List component bound to an ArrayCollection. I have dragEnable, dragMoveEnable, etc set to true. When I drag an item and drop it (to reorder the items) i do NOT get a Collection event "move".  I instead get two collection events being dispatched...a "remove" and then an "add". It makes sense that it is removing the item from the old location and then adding it back in the new, but I need to know when the items are reordered and save the new order server side. Since users can also add and delete to the list, it's not enough for me to know when an "add" or "remove" occurs.


      What gives? I know at some point I was responding to a "move" event in this case and it worked. My existing code used to work! What could have changed to break this?


      What DOES raise a "move" CollectionEvent anyway?


      Any help appreciated. Thanks!



        • 1. Re: CollectionEvent MOVE
          Gregory Lafrance Level 6

          You said your code was working as expected before. How did your code work before? How did you handle this "move" situation successfully before?

          • 2. Re: CollectionEvent MOVE
            mlmadque Level 1

            I simply listened for CollectionEvent. The event handler checked the

            event.kind. If it was "move" I would make my web service call to save the new order to the server.


            Then I get a call from someone at work who says, "Hey the reordering is not saving any more". I have no idea how long it has not been working. When I debug I see that the collection event kind is never "move" so it never triggers the web service call.


            Am I missing something about the collection change "move"??



            • 3. Re: CollectionEvent MOVE

              yes i noticed the same with the new ArrayList class. The ArrayList class doesnt even have code for  MOVE events.

              On the other hand, i tried debugging the ArrayCollection code to see when the MOVE event is triggered using a simple list (spark list) and dragMoveEnabled set to true.  And it doesnt work. There is some code that is supposed to handle MOVE in ArrayCollection but it never gets triggered.

              I always get 2 events like you described. This seems to me like a regression and ill try to file a bug for it

              • 4. Re: CollectionEvent MOVE
                UbuntuPenguin Level 4



                The event code may not be on the ArrayList class.  It may be on a superclass such as ListCollectionView.

                • 5. Re: CollectionEvent MOVE
                  raedatoui Level 1

                  ok because ArrayList is supposed to be a simple implementation of IList, which is a design decision that i question. I understand that ArrayList cant support filters and sorts like ArrayCollection, but a MOVE seems to be an evident thing for me, since the spark List takes an IList at a minimum, and a spark list can move items around.

                  • 6. Re: CollectionEvent MOVE
                    UbuntuPenguin Level 4

                    Wait a minute , are we talking about an ArrayCollection , or an ArrayList.  You mention ArrayCollection in your leading post , but some of us read that as ArrayList.  ArrayCollection , CollectionChange event is defined by the ListCollectionView class.  Whereas the ArrayList has its CollectionChange event dispatching defined by the ArrayList class.  EIther way , your problem is perplexing.


                    Sincerely ,