Hi, 

I've been searching for a good solution to implementing object equality. I'm 
familiar with 
ObjectUtil, etc., but it still makes things harder than they should be. 

It may be best to illustrate this with an example. Suppose I have a ComboBox 
with an 
ArrayCollection as a data provider. The ArrayCollection is populated with value 
objects 
from the server, e.g., User objects.  Suppose that I have a Task class, and a 
Task may 
have an assignedToUser property, which is a User instance. When the someone 
selects a 
Task (say, in a master-detail view), I would like the ComboBox to set its 
selectedItem to 
the user for the given Task, i.e., combBox.selectedItem = myUser.assignedToUser.

The problem is that no Task in the ComboBox's data provider and the User's 
assignedToUser property are ever equal using the == or === operators. 

So I would like to implement a custom equality for User, and have the ComboBox 
use that 
to set its selectedItem to the specified user. In Java, this is easily done by 
overriding the 
equals() and hashCode() methods of User. 

Any suggestions on how to achieve something similar in Flex would be much 
appreciated.
 
Thanks, 

-- Frank 

Reply via email to