I think that I found a likely bug in the Spark List control, or the documentation that is provided explains the process wrong, or I have a misunderstanding of vecors. Either way, I do not know how to report this, so please let me know.
Here is the situation. I have a Spark List with a tile layout that is populated with thumbnail images. I have allowMultipleSelection set to true so that I can select a number of the thumbnails to delete. I don't have a problem deleting the files if I shift-select a bunch of contiguous files, but if I ctrl-click multiple files, especially discontiguous files, the wrong files get deleted. Let me rephrase, the files get deleted in the wrong order from the array collection. The selected items are stored in a group of vectors that are supposed to hold the indices in the reverse order than they were selected. Here is the documentation from the Flex 4.5 Help:
"These Vectors contain a list of the selected indices and selected data items in the reverse order in which they were selected. That means the first element in each Vector corresponds to the last item selected."
Upon tracing the indices in my application, I found that they were not in the reverse order than they were selected. So I looked at the example underneath of the documentation Adobe provides and you can see the problem for yourself. Here is the link:
Scroll about halfway down the screen to the section entitled "Handling multiple selection in the Spark List control" and run the sample application under that heading. If you click the first item and then shift-click the fourth item, the selected indices show 3-2-1-0 which is correct. But if you select the first item(index 0), ctrl-click the third item(index 2) and the fifth item(index 4), the selected indices list should show 4-2-0 but it doesn't, it shows 4-0-2. According to the documentation, it should be in the reverse order to what was selected, but it is not. This is what is happening in my application as well. A trace of the indices is not the reverse order from what I select. When deleting items from an arrayCollection for the dataprovider, this can cause a lot of problems if you don't know what order they are being deleted.
Actually, i wish that they made the vector list from the highest indice to the lowest. You can remove items from an array collection from the top down without causing any problems even if the items are discontiguous. But if you try and removed a lower indice before a higher indice, the higher indice will no longer be pointing at the right element in the arrayCollection.
Am I reading the documentation wrong, misunderstanding vectors, or is this a likely bug? How do I report this?
Here is the link to the bug that I reported. So far there has been no activity or responses to it, no priority assigned to it. Hope I submitted it correctly.
Thanks William for reporting the bug in Adobe. I also have requirement for my list comp. to show in order they selected, and I found the same thing. Do you think there is any other solution we can do until Adobe fix this thing? Please reply to this page if you find some solution and i will also try.