For loop in array not working properly?

I need some guidance.


var temp:Array = new Array();
temp[0] = 0;
temp[1] = 1;
temp[2] = 2;

for(var i in temp){
	trace(temp*);
}
for(var i = 0; i < temp.length; i++){
	trace(temp*);
}

Logically it should print out
0
1
2
0
1
2

But instead it prints out
2
1
0
0
1
2

Why? Try this out for yourself and see if it works.