Hey guys, here’s a simple example of an array that has 2 string values per row…
then the 2nd array is the same but alphabetically ordered…
Where I am stuck is when I want to grab the array value of teams using indexOf
var teams:Array = new Array();
var teamsInAlphabet:Array = new Array();
teams.push({name:"Brazil", continent:"South America"});
teams.push({name:"Germany", continent:"Europe"});
teams.push({name:"Spain", continent:"Europe"});
teams.push({name:"Italy", continent:"Europe"});
teams.push({name:"Argentina", continent:"South America"});
teamsInAlphabet = teams.concat();
teamsInAlphabet.sortOn(["name", "continent"]);
//(here's the problem) in this case I want the teams array indexOf teamsInAlphabet[0].name...
var playerTeamCorrectIndex:int = teams.indexOf(teamsInAlphabet[0].name); //INCORRECT CODE... help?
//should be something like: teams.name.indexOf(teamsInAlphabet[0].name //but with correct syntax...
trace(playerTeamCorrectIndex) //INCORRECT VALUE
Thanks a lot in advance!