PDA

View Full Version : loadVariablesNUm to load Arrays


AndyMun
10-19-2008, 10:13 AM
what should i put in "test.txt", so when it loads, i should have something like this.

title[1]=some title 1
title[2]=the second title
title[3]=the last title

i triend &title[1]=some title 1&title[2]=.... but it dosen't works.

atomic
10-19-2008, 03:38 PM
This seems to work...


var scope:MovieClip = this;
var title_arr:Array = new Array();
var lv:LoadVars = new LoadVars();

lv.onData = function(titletext:String){
title_arr = titletext.split(",");
}

stop();

lv.load("test.txt");

this.onEnterFrame = function() {
if ( title_arr[0] != undefined ){
trace(title_arr);
delete this.onEnterFrame;
}
};


And the test file's text is simply...


some title 1,the second title,the last title

AndyMun
10-19-2008, 05:36 PM
10x, but i have to deal with a data base, and i have to extract the title, the background, the description, and then the content, does exist a simpler way

atomic
10-19-2008, 07:23 PM
Never worked with a date base, sorry!