Jump to content

Help calling functions.


vytas

Recommended Posts

Ok i have this code

function drawPlayers() { for (i = 0; i < ystore.length; i++) {	alert('im getting there');	playerobject[i] = makeObj("character",xstore[i],ystore[i]);	map[ystore[i]][xstore[i]] == 3;	playerMap[ystore[i]][xstore[i]] == playerstore[i]; }}function removePlayers() { for (i = 0; i < ystore.length; i++) {	alert('im being called');	delete playerobject[i];	map[ystore[i]][xstore[i]] == 0;	playerMap[ystore[i]][xstore[i]] == 0; }}function stripPlayer(info) { removePlayers(); var xstore = []; var ystore = []; var playerstore = []; var players = info.getElementsByTagName("player"); for (i = 0; i < players.length; i++) {	xstore.push(players[i].childNodes[0].childNodes[0].nodeValue); } for (j = 0; j < players.length; j++) {	ystore.push(players[j].childNodes[1].childNodes[0].nodeValue); } for (k = 0; k < players.length; k++) {	playerstore.push(players[k].childNodes[2].childNodes[0].nodeValue); } drawPlayers();}

now something strange is going. My functions drawPlayers() and removePlayers Aren't being called i get no errors in Internet Explorer. I know for sure that my function stripPlayer() is working as it should be and the ystore contains 2 elements. So i don't know what is going wrong here. the makeObj is also working correctly so i don't know the problem. any help would be appreciated. This is part of a really big code so if u need the rest P.M. me. Vytas

Link to comment
Share on other sites

function stripPlayer(info) { removePlayers(); var xstore = []; var ystore = []; var playerstore = []; ...

It looks like you are declaring the arrays as local variables inside the stripPlayer function and they are not accessible to your other functions.
Link to comment
Share on other sites

Ye i noticed later.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...