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_dataproviders_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>

