Duplicate mx_internal_uid properties in flex list items

I ran into an issue today where I was dragging items from a list and having another list updated with the drop data. So lets say for example list A contains 3 items (item1, item2, and item3 respectively), if I dragged and dropped multiple copies of item1, they would properly display in list2; however, when I moused over one of the items in list2 the list seemed to think that their was only one “item1″ object in it’s array collection. The visual result of this was that hovering over one of the item1 objects in list2 would show the over state for the last item in the list (rather than the one that I was actually hovering over). After some digging, I found a property called “mx_internal_uid” that flex uses to keep track of objects in a number of visual components (such as list and datagrid). What was happening was that when dropped the item, a copy of it was being created, and the mx_internal_uid property was being copied over to the new object. The result of this was that the list would break because it handles it’s selection and other state updates by referencing this property. If that made any sense (I’ll try to come back and make this a bit more clear later), check out the solution.

The solution:
The best solution is probably to use strongly type custom data objects in this case (that’s what I did at least), instead of using simple Objects (which is what I was originally doing). The other thing that seems to work is creating a deep copy of the object using the ObjectUtils.copy() method and then setting the “mx_internal_uid” property to blank.

I’ll try to post a more clear explanation of this issue along with a code sample when I get some more time.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button


Leave a Reply