Hey,
please forgive my lack of knowledge on this, I have been trying to create foundations for a 4 team based application that will record scores based on user input.
I will try and explain as best i can. This is my script that I wish to use to create foundations:
var rommell:Object = new Object();
rommell.team = "rommell";
var rommellb:Object = new Object();
rommellb.team = "rommellb";
team = "rommell";
rom_btn.onRelease = function(){
team_txt.text = rommell.team;
}
romb_btn.onRelease = function(){
team_txt.text = rommellb.team;
}
This should create two of the four (team) objects I need, I can get the objects displaying the team name in the team_txt text field from the button presses. I now wish to read from an external file to read differing variables for each object. I have 2 (test) text fields that should display a number in the text field.
var externalData:LoadVars = new LoadVars();
externalData.onLoad = function(){
field1_txt.text = externalData.rommell1;
field2_txt.text = externalData.rommell2;
}
externalData.load("stats.txt")
This is an example of what my external data file is, its just a notepad in the same dir as the FLA.
@rommell
@rommell1=60
@rommell2=9
@rommellb1=5
@rommellb1=4
I have tried adding field1_txt.text=Number(externalData.rommell1);. This hasn’t worked nor has the above code. Once i have got this working I can then add further variables that I need. Once done I want to try and create an if statement on each team button release such as:
rom_btn.onRelease = function() {
team_txt.text = rommell.team;
if (team_txt.text == "rommell") {
field1_txt.text = externalData.rommell1;
field2_txt.text = externalData.rommell2;
}
and the same for the other 4 buttons:
romb_btn.onRelease = function() {
team_txt.text = rommellb.team;
if (team_txt.text == "rommellb") {
field1_txt.text = externalData.rommellb1;
field2_txt.text = externalData.rommellb2;
}
Is this going to achieve what i want? I wanted to use shared objects but I’m not advanced enough to fully use them, please advise on what you guys think the best way to do this is.
Any help in getting this step set-up is massively appreciated, I’m getting stressed with this and it’s my 4th or 5th go. Ahhhh.
Many Thanks