-
help storing data in flash for later use, maybe regarding arrays or object
I got a bunch of data off an XML file, player node with name, score etc
I need to store these data so I can manipulate it so I can re-write the XML file.
I can think of one way of doing it,simply create a bunch of duplicate movieclips, one for each player with variables appended to it, one for score, one for name etc.
However I am sure there must be a way of doing this without using movieclips. Basically what I need is the data to be accessible something like this:
player1.name = rob
player1.score = 200
player2.name = robert
player2.score = 100
I thought Array or Object would do the trick, but I have not used either before and they don't seem to do anything this straight forward, most likely because I am doing something wrong.
Can anybody help me?
-
try this:
i=0:
do{
i++;
_global["playername"+i] == _root["player"+i].name;
_global["playerscore"+i] == _root["player"+i].score;
}while(x<100);
This will give you global variables you can access later.
Trying deperately to understand
actionscript
-
heh, I couldn't get that to work but you sparked me in the right direction (saving things globally so they don't get overwritten), thanks for that:
var player:Object = new Object;
passxmlon = doc.firstChild.childNodes[counter01];
tempId = passxmlon.childNodes[0].firstChild;
tempScore = passxmlon.childNodes[1].firstChild;
tempName = passxmlon.childNodes[2].firstChild;
tempCompany = passxmlon.childNodes[3].firstChild;
tempEmail = passxmlon.childNodes[4].firstChild;
tempPhone = passxmlon.childNodes[5].firstChild;
player["player"+counter01] = {player_id:tempId, player_score:tempScore, player_name:tempName, player_company:tempCompany, player_email:tempEmail, player_phone:tempPhone};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|