0 Replies Latest reply on Apr 23, 2007 12:38 AM by cosmacol

    Why does setSelectedItem perform a simple equality (==) check?

    cosmacol Level 1
      I have a list base component (a TileList) loaded by creating objects out of a web service response. Now, let's say I have another web service that periodically refresh the "selected item".

      In the response handler of both the services, raw dynamic objects are converted to strongly typed actionscript classes which implements the UID interface. I'd like to use setSelectedItem method on the list to refresh the selected one, but it doesn't work. Reading the sources, I saw that it performs a standard equality check (== operator), which means that the very same instance of an object must be passed in, in order for the comparison to match.

      The result of this is that I must cycle the entire items collection, perform the comparison by hand, then pass in the matching instance. I think this is a waste of time and code, because internally the same cycle will be repeated again.. doesn't the UID interface exist to avoid this kind of things? Am I missing something?

      Thank you in advance