Hi, I’m trying to populate several arrays, the arrays I will use to store my player hands with the values popped out off another array but I can’t seem to see the problem.
I’m just following the logic used to populate my previous array, the aDeck, but whenever I trace it, I get undefined. Isn’t it supposed to work identically? If I change the type to Object instead of array, I do get [Object, Object] as a response.
var aCardSuitValues:Array = ["oros", "copes", "espases", "bastos"];
var aCardValues:Array = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
var aTemp:Array = new Array();
for (i = 0; i < 4; i++)
{
for (j = 0; j < 12; j++)
{
var oCard:Object = new Object();
oCard.sCardSuit = i;
oCard.sCardNumber = j;
aTemp.push(oCard);
}
}
var aDeck:Array = new Array();
while (aTemp.length > 0)
{
var r:Number = Math.floor(Math.random() * aTemp.length);
aDeck.push(aTemp[r]);
aTemp.splice(r,1);
}
var aPlayer1Hand:Array = new Array();
for (k = 1; k <= 12; k++)
{
aPlayer1Hand.push.aDeck.pop();
trace("aPlayer1Hand =" + aPlayer1Hand);
//trace(aCardValues[aPlayer1Hand[k].sCardNumber] + " - " + aCardSuits[aPlayer1Hand[k].sCardSuit]);
}