Hi,
is any anybody who could help me?
I’m solving this problem:
I got flash game recieving informations from XML file. Action script for my game is already written and I should probably use it. It contains:
players.load("data.xml");
players.onLoad = convertXMLPlayers;
function convertXMLPlayers()
{
trace (this);
mainTag = new XML();
elementTag = new XML();
playersList = new Array();
propertiesList = new Array();
playersArray = [];
mainTag = this.firstChild.nextSibling;
if (mainTag.nodeName.toLowerCase() == "players_root_tag")
{
playersList = mainTag.childNodes;
for (i = 0; i < playersList.length; i++)
{
if (playersList*.nodeName.toLowerCase() == "player")
{
propertiesList = playersList*.childNodes;
var name = "";
var mail = "";
var day = "";
var hits = "";
for (j = 0; propertiesList.length >= j; j++)
{
elementTag = propertiesList[j];
elementType = elementTag.nodeName.toLowerCase();
if (elementType == "name")
{
name = elementTag.firstChild.nodeValue;
continue;
} // end if
if (elementType == "mail")
{
mail = elementTag.firstChild.nodeValue;
continue;
} // end if
if (elementType == "day")
{
day = elementTag.firstChild.nodeValue;
continue;
} // end if
if (elementType == "hits")
{
hits = elementTag.firstChild.nodeValue;
} // end if
} // end of for
playersArray[playersArray.length] = [name, mail, day, hits];
} // end if
} // end of for
} // end if
trace ("* " + playersArray);
createTopList();
} // End of the function
Only what I need is to prepare the right xml source. My XML file looks like this and there’s some problem I’m not able to find:
<players_root_tag>
<player>
<name>Mr.Chunk</name>
<mail>chunk@chunk.ch</mail>
<day>05.00</day>
<hits>456</hits>
</player>
</players_root_tag>
I tried a lot, but flash file is still not loading content of this XML.
Could you help me, please?
chulimanga - chulimanga(at)yahoo.com