In this case you need to use Bindable

BindingUtils.bindProperty(myUser,"assignedToUser",combBox,"selectedItem"); if 
you want to reflect the changes from myUser.assignedToUser to 
CombBox.selectedItem..
 Thanks,

with Regards,
Jitendra Jain




----- Original Message ----
From: frank_sommers <[EMAIL PROTECTED]>
To: [email protected]
Sent: Saturday, 11 October, 2008 8:24:18 AM
Subject: [flexcoders] Java-like equals() method?


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.selectedIte m = myUser.assignedToUs 
er.

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 

 


      Connect with friends all over the world. Get Yahoo! India Messenger at 
http://in.messenger.yahoo.com/?wm=n/

Reply via email to