I'm pretty sure that you'll get selection problems if you don't have unique data items.
Gordon Smith Adobe Flex SDK Team ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Maciek Sakrejda Sent: Wednesday, May 14, 2008 4:32 PM To: flexcoders Subject: [flexcoders] object in components Is it possible to have the same object (i.e., the same reference) twice in a single Tree (or other similar control)? I have a tree and a list that map the relationships between two types of classes (simplified here): public class User { public roles:ArrayCollection; // Both addRole and removeRole do what you think they might public addRole(role:Role) { /* implementation */ } public removeRole(role:Role) { /* implementation */ } } public class Role { public name:String; } Users and Roles are originally pulled in as collections from an AMF call. That works fine. I've set up a UserRoleDataDescriptor that extends DefaultDataDescriptor to map Users and their Roles into a 2-level-deep tree structure. Now, I also have a List of all the available Roles. I've added drag-and-drop support from the list to the tree to enable adding new roles to existing users. This caused some weird behavior when I originally did it by just calling addRole with the Role object being dragged. Specifically, when I would add the same role to more than one user, I'd see weird behavior when trying to remove roles or even just clicking on them. Basically, it looked like the tree would get confused and highlight a different UI instance of the same backing object. I'm working around this right now by simply cloning the Role object (instead of always adding the same one). This works fine, but it's a little strange: conceptually, these users share a single role, not copies of a role. Should I be using a wrapper class around Users and Roles (so that I can clone the RoleWrapper but keep a reference to the same Role)? -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com <http://www.truviso.com>