I have this weird issue and i can't figure it out, let me explain: I have a java object A which has a HashMap variable myMap, this map will hold objects of class B. In ActionScript i have the corresponding class A which has a variable myMap but since there is no HashMap in ActionScript its type is Object and i also have the corresponding class B.
[RemoteClass(alias="com.test.A")] public class A { public var myMap:Object; // this is the HashMap in Java } [RemoteClass(alias="com.test.B")] public class B { public var id:Number; public var name:String; } I need to put the objects B contained in the map inside a DataGrid so i am obtaining the object of class A using a RemoteObject and then i iterate over the myMap property using a for each in loop, like this: for each(var i:* in objectA.myMap) { someArrayCollection.add(i); } The first issue appears here, suppose the java HashMap contains 3 elements, in the ActionScript loop i get 4 elements, the fourth one being a reference to the A object (its key appears as "owner"). In order to avoid this i use the "is" operator like this: for each(var i:* in objectA.myMap) { if (i is B) { someArrayCollection.add(i); } } Now here is the real issue, when i do this the B objects contained in the myMap property are reset to their initial values (NaN and empty string according to the B class). I changed the if condition to this and worked: for each(var i:* in objectA.myMap) { if (!(i is A)) { someArrayCollection.add(i); } } When i did this the DataGrid shows the elements in the someArrayCollection perfectly fine. I did a little more testing and i "figured" out the issue, if i use an instance of class B anywhere in my application, the values of the B objects inside the myMap property are reset, for example: for each(var i:* in objectA.myMap) { if (i is B) { someArrayCollection.add(i); } } var test:B = new B(); This resets the B objects inside the myMap property of the A object which makes no absolute sense, this is why when i used the B class in the if condition the objects reset their values. So the thing is whenever i use the B class, which is the class of the objects inside myMap, the B objects are reset!!!! Does anyone know how to fix this????? I am using Flex 2.01 hotfix 3, i wonder if this is some kind of bug that was solved in a later release. Any help would be appreciated.