This is the 3rd forum i’ve posted this on now lol. No one can or will help me with this… and it dont even seem that hard!
So PLEASE help,
I’ve created a list of rankings for top scores using the datagrid component, which you can see here, and at the moment the data for the rows/columns listed within the dataGrid Component are all in the AS3 code (below), but i dont want it in the AS3 code, i want that code in a external file (dont know what kinda file to use for this?) which the DataGrid Component would load from and display.
Heres the AS3 code:
import fl.controls.DataGrid;
import fl.events.DataGridEvent;
import fl.controls.ScrollPolicy;
import fl.data.DataProvider;
import flash.net.navigateToURL;
var i:uint;
var totalRows:uint = 5;
var dp:DataProvider = new DataProvider();
dp.addItem({Rank:"1", Name:"lightspeed", Time:"13.219", CPU_Type:"C2D E6600", CPU_MHz:"3887 MHz", RAM:"4096MB DDR2", RAM_MHz: "864 MHz"}),
dp.addItem({Rank:"2", Name:"Beany", Time:"13.766", CPU_Type:"C2D E6600", CPU_MHz:"3700 MHz", RAM:"2048MB DDR2", RAM_MHz: "1235 MHz"}),
dp.addItem({Rank:"3", Name:"Timmaah", Time:"13.984", CPU_Type:"C2D E6600", CPU_MHz:"3627 MHz", RAM:"2048MB DDR2", RAM_MHz: "1005 MHz"}),
dp.addItem({Rank:"4", Name:"Darth Vader", Time:"14.000", CPU_Type:"C2D E6600", CPU_MHz:"3600 MHz", RAM:"1024MB DDR2", RAM_MHz: "1000 MHz"}),
dp.addItem({Rank:"5", Name:"ik0n", Time:"14.181", CPU_Type:"C2D E6600", CPU_MHz:"3600 MHz", RAM:"2048MB DDR2", RAM_MHz: "800 MHz"}),
var dg:DataGrid = new DataGrid();
dg.setSize(576, 425);
dg.move(20, 112);
dg.sortableColumns = false;
dg.columns = ["Rank", "Name", "Time", "CPU_Type", "CPU_MHz", "RAM", "RAM_MHz"];
dg.columns[0].width = 45;
dg.columns[1].width = 136;
dg.columns[2].width = 65;
dg.columns[3].width = 110;
dg.columns[4].width = 80;
dg.columns[5].width = 100;
dg.columns[6].width = 80;
dg.dataProvider = dp;
addChild(dg);
dg.addEventListener(Event.CHANGE, topTen);
function topTen(event:Event) {
if (event.currentTarget.selectedItem.Rank == 1) {
gotoAndStop(11);
}
if (event.currentTarget.selectedItem.Rank == 2) {
gotoAndStop(12);
}
if (event.currentTarget.selectedItem.Rank == 3) {
gotoAndStop(13);
}
if (event.currentTarget.selectedItem.Rank == 4) {
gotoAndStop(14);
}
if (event.currentTarget.selectedItem.Rank == 5) {
gotoAndStop(15);
}
if (event.currentTarget.selectedItem.Rank == 6) {
gotoAndStop(16);
}
if (event.currentTarget.selectedItem.Rank == 7) {
gotoAndStop(17);
}
if (event.currentTarget.selectedItem.Rank == 8) {
gotoAndStop(18);
}
if (event.currentTarget.selectedItem.Rank == 9) {
gotoAndStop(19);
}
if (event.currentTarget.selectedItem.Rank == 10) {
gotoAndStop(20);
}
if (event.currentTarget.selectedItem.Rank == 11) {
gotoAndPlay(21);
}
if (event.currentTarget.selectedItem.Rank == 12) {
gotoAndStop(22);
}
if (event.currentTarget.selectedItem.Rank == 13) {
gotoAndStop(23);
}
if (event.currentTarget.selectedItem.Rank == 14) {
gotoAndStop(24);
}
if (event.currentTarget.selectedItem.Rank == 15) {
gotoAndStop(25);
}
if (event.currentTarget.selectedItem.Rank == 16) {
gotoAndStop(26);
}
if (event.currentTarget.selectedItem.Rank == 17) {
gotoAndStop(27);
}
if (event.currentTarget.selectedItem.Rank == 18) {
gotoAndStop(28);
}
if (event.currentTarget.selectedItem.Rank == 19) {
gotoAndStop(29);
}
if (event.currentTarget.selectedItem.Rank == 20) {
gotoAndStop(30);
}
}
The reason i want this is because i’m trying to create a submit form so people can post there scores themselfs into the rankings, rather than me always having to update it manually, and i want the scores to be posted to an external file (like .txt .as, .xml, no idea which to use??) Then the DataGrid Component would load the submitted scores from the external file.
I’m rubbish with AS3 so could someone please edit the above code to what is needed? Or explain in detail what i need to do? Because most of time people reply saying do this and that, and i’ve no idea what there on about because i’m not good with AS in general…
And i can put up the .FLA for download if needed…
Thanks!