Associative array vs vector?
i creating multiplayer game multi betspot. in want save each player game details, have created associative array called player.
when ever new player came ill call below method update array.
i in think of replacing vector, vector can have same datatype. want save different kind of data.
any suggestion.
function createarray(seatno:number, spot:string, id:int = 0){
var betcontainer:movieclip;
if (player[seatno] == undefined)
{
player[seatno] = [];
}
if (player[seatno][spot] == undefined)
{
player[seatno][spot] = [];
betcontainer = new movieclip();
var spotobj:object = new object();
spotobj.betamount = 0;
spotobj.winamount = 0;
spotobj.lastbet = 0;
spotobj.id = spot+"_"+seatno;
betcontainer.name = spot+"_"+seatno;
addchild(betcontainer)
spotobj.container = betcontainer;
player[seatno][spot][id] = spotobj;
}
}
thanks & regards,
ayathas.
you want use that's unique each player array's key. id fill role don't appear require id (let alone distinct one) each player.
is there that's unique each player?
More discussions in ActionScript 3
adobe
Comments
Post a Comment