Okay just a quick shoot here…okay I try to refresh updated textfile data every 2 seconds and it’s works ok if I’m using normal delimiters and proper data arrangement in textfile such as
//in textfile
david||30
michael||40
john||50
but my problem is how to load the data from textfile which store not in proper way and using ‘space’ as a delimiters
david 30
michael 40
john 50
so here’s ar emy attempt code so far stil returning undefined
stop();
var lv:LoadVars = new LoadVars();
var someArr:Array = new Array();
//counting purposing
var counter:Number = 0;
function refreshData():Void{
lv.onLoad = function(mydata){
trace(mydata);//output true
itemlist = mydata.split("");
trace(itemlist);//output undefined
for(var i=0;i<itemlist.length;i++){
someArr.push([itemlist*[0],itemlist*[1]]);
}
trace(someArr);
/*
if(success){
counter++;
trace("succes open textfile and opening textfiel for the"+" "+counter+" "+"time");
}else{
trace("fail open textfile");
}
*/
}
lv.load("thedata.txt");
}
var loadData = setInterval(refreshData,2000);
So really need help with it…any help are really appreciated…tq in advanced
[quote=randomagain;2347671]sorry but can’t help resist asking… why not xml?
this way you need String stuff
subString(start,end)
indexOf(start, [“id”]);
to seperate the two strings, you need an ID at the start and end of each bit, so you can zoom in as it were
and get the variable you want
**xml is easier because you can just create seperate elements **[/quote]
Answering ur queations ok actually my attempt is just to display result and update textfile data using flash only nothing fancy about it…why not using XML? it is because I write the textfile using C++ so the processing also happens in C++… using Flash as a medium for visualise result purposing only…anyway tq mate…for ur times…
hi nathan99…
thanks for the reply nathan…but frankly speaking …I really not having issues with proper data arrangement in textfile only with raw data only…I mean not proper save in tetxfile like example I provide previously…anyway thanks for ur concern mate
I guess my problem still not solved and I’ve being spend and a days to figure out…but still unsuccessfull…the data in textfile being loaded properly…but the problem is now it do tracing the undefined value as well so when I push the value in array it will output the array length as 5 value for this textfile format:
david 30
michael 40
john 50
all data being separated for one space only
and here’s my attempt code so far…
ActionScript Code:
[LEFT][COLOR=#0000FF]stop[/COLOR]COLOR=#000000[/COLOR];