Also consider using a ModelLocator to store this list of persons. Have a look at Cairngorm - it helps.

/J

Derrick Anderson skrev:

i think i am going to take your suggestion and use the person instances themselves as the dataprovider for the combobox, thanks for setting me straight!

d.

On 8/7/07, * Gordon Smith* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    If you really need to find a Person instance based on its ID, that
    would depend on how and where you stored the Person instances. In
    an Array? In an Object with the IDs as the keys and the instance
    references as the values?
But it sounds like it would be easier if each item in the
    dataProvider for your ComboBox was a Person instance.
    Then comboBox.selectedItem would give you the selected Person
    instance. You'd simply specify labelField="Name" to make the
    ComboBox display the names.
- Gordon

    ------------------------------------------------------------------------
    *From:* [email protected] <http://ups.com>
    [mailto:flexcoders@ <mailto:flexcoders@>yahoogroups.com
    <http://yahoogroups.com>] *On Behalf Of *Derrick Anderson
    *Sent:* Tuesday, August 07, 2007 11:24 AM
    *To:* [email protected] <http://ups.com>
    *Subject:* [flexcoders] get class instance by property

    hi,

    i think i have painted myself into a procedural corner, i have
    numerous instances of a class 'Person' in my application.  Now i
    have a combobox with the ID and Name of all these 'People'.  When
    I select a name in the combobox, i want to run a function on that
    instance of the Person that ID belongs to- but have no idea how to
    get that instance when all i have is the ID to get it by.

    How do you reference a class instance by one of it's properties?

    d.


Reply via email to