trace the contents from arrays in object
Hi, I know just posted yesterday abut this subject and even though I'm reading and testing, I'm confused with objects and associative arrays. I believe I have a random shuffled deck now, but I still can't find the way to get a trace from it.
Code:
var suits:Array = new Array("o", "c", "e", "b");
var aTemp:Array = new Array();
for (i = 0; i < suits.length; i++)
{
for (j = 1; j <= 12; j++)
{
var oCard:Object = new Object();
oCard.sCardSuit = suits[i];
oCard.sCardNumber = j;
aTemp.push(oCard);
var aDeck:Array = new Array();
while (aTemp.length > 0)
{
r = Math.floor(Math.random() * aTemp.length);
aDeck.push(aTemp[r]);
aTemp.splice(r,1);
for (var oCard in aDeck){
trace(oCard.sCardSuit + " " + oCard.sCardNumber); // traces undefined
isn't the object in the array and its properties; the oCard's properties
}
}
}
}
thanks in advance for any hints