Thanks for the clarification but I have a feeling that I would not be
the last person make similar assumtions after reading sections like this
from the Developer's guide.

-- Excerpt from the section 'Data providers and the uid property' ----

"If Flex must consider two or more different objects to be identical,
the objects must implement the IUID interface so that you can assign the
same uid value to multiple objects. A typical case where you must
implement the IUID interface is an application that uses paged
collections. As the cursor moves through the collection, a particular
item might be pulled down from the server and released from memory
repeatedly. Every time the item is pulled into memory, a new object is
created to represent the item. If you need to compare items for
equality, Flex should consider all objects that represent the same item
to be the same "thing."


--- In [email protected], Alex Harui <[EMAIL PROTECTED]> wrote:
>
> UID is mainly used by selection management in the list classes. It is
not used by actionscript for testing object equality
>
> From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of erdal
> Sent: Monday, November 24, 2008 1:32 PM
> To: [email protected]
> Subject: [flexcoders] UID, how is it used ?
>
>
> I think I am misinterpreting the uid property usage
http://livedocs.adobe.com/flex/3/html/help.html?content=about_dataprovid\
ers_8.html
>
> In a BlazeDS application I am using an ArrayCollection of items (VOs)
returned from the server. I thought when I implement the iuid interface,
that will guide flex framework for deciding on objects equality and then
I can use the getItemIndex(Obj) kind of functions. But It didn't work.
So I wrote this simple test.
>
> I was expecting to see person1 and clone1 would pass equality test.
But they didn't. What am I missing ? I am actually looking for something
I can use like Java equals.
>
> -- File Person.as
------------------------------------------------------------------------\
-----------------
>
> package
> {
> import mx.core.IUID;
> public class Person implements IUID {
> public var _uid:String;
>
> public function get uid(): String {
> return _uid;
> }
>
> public function Person() {
> }
>
> public function set uid(value: String): void {
> _uid=value;
> }
> }
> }
>
> -- File test.mxml --------------------------------------------
>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">
> <mx:Script>
> <![CDATA[
> public function onClick():void
> {
> var person1:Person = new Person();
> var person2:Person = new Person();
> var clone1:Person = new Person();
> person1.uid = "1";
> person2.uid = "2";
> clone1.uid = "1";
> trace("UIDs are person1:"+person1.uid+" person2:"+person2.uid+"
clone1:"+clone1.uid);
> trace("Is person1 and person2 equal ? " + (person1 == person2));
> trace("Is person1 and twin1 equal ? " + (person1 == clone1));
> }
>
> ]]>
> </mx:Script>
> <mx:Button label="run equality test" click="onClick()" />
> </mx:Application>
>


Reply via email to