Macke has already pointed out the problem. The operator ==will tell you (for reference types such as Array objects) if two variables point to the same object. This is clearly not the case. You have 2 different objects that have the same content.
So what you are probably looking for is a way to compare if 2 arrays have the same content. This seemingly simple task can be more complicated than it seems.
The standard way is to use this function:
function areEqual(a:Array,b:Array):Boolean {
if(a.length != b.length) {
return false;
}
var len:int = a.length;
for(var i:int = 0; i < len; i++) {
if(a[i] !== b[i]) {
return false;
}
}
return true;
}
(, ) . , ( ). , Numbers ( ints uints), Strings, Boolean, null undefined :
:
var a:int = 0;
var b:int = 0;
:
trace(a == b);
== true, vars :
var a:Object = {data:1};
var b:Object = {data:1};
trace(a == b);
var a:Object = {data:1};
var b:Object = a;
trace(a == b);
, (, , ), isEqual :
var arr_1:Array = [{data:1}];
var arr_2:Array = [{data:1}];
trace(areEqual(arr_1,arr_2));
? {data:1}, arr_1, {data:1}, arr_2.
, , , , , . , .. I.e. , Γ¬d ( , Γ¬d). , , , .