Question
Can't load data from PHP into dataGrid
the php script outputs a urlencoded string, with the first
variable named records, which has an integer value.
The AS code looks like this:
var zDP=new Array();
var getFeed:LoadVars=new LoadVars();
getFeed.load(" http://localhost/php/sendrecords.php?ck="+new Date().getTime());
getFeed.onLoad = function(success) {
if (!success) {
trace("Can not load");
} else {
loading_mc.removeMovieClip();
trace("Loaded");
var records:Number=this["records"];
trace(records);
if (numsigs==0)
trace("No msgs yet");
else {
for (var i=0;i<records;i++) {
trace(this["s1"+i]+" "+this["s2"+i]+" "+this["s3"+i]+" "+this["s4"+i]+" "+this["s5"+i]+" "+this["s6"+i]+" "+this["s7"+i]);
zDP.addItem({c1:this["s1"+i], c2:this["s2"+i], c3:this["s3"+i], c4:this["s4l"+i], c5:this["s5"+i],c6:this["s6"+i],c7:this["s7"+i]});
}
}
}
}
zDg.dataProvider=zDP;
stop();
--And it goes to trace(records), and outputs "undefined". Anyone has any idea on what I am doing wrong here?
TIA.
gm.
The AS code looks like this:
var zDP=new Array();
var getFeed:LoadVars=new LoadVars();
getFeed.load(" http://localhost/php/sendrecords.php?ck="+new Date().getTime());
getFeed.onLoad = function(success) {
if (!success) {
trace("Can not load");
} else {
loading_mc.removeMovieClip();
trace("Loaded");
var records:Number=this["records"];
trace(records);
if (numsigs==0)
trace("No msgs yet");
else {
for (var i=0;i<records;i++) {
trace(this["s1"+i]+" "+this["s2"+i]+" "+this["s3"+i]+" "+this["s4"+i]+" "+this["s5"+i]+" "+this["s6"+i]+" "+this["s7"+i]);
zDP.addItem({c1:this["s1"+i], c2:this["s2"+i], c3:this["s3"+i], c4:this["s4l"+i], c5:this["s5"+i],c6:this["s6"+i],c7:this["s7"+i]});
}
}
}
}
zDg.dataProvider=zDP;
stop();
--And it goes to trace(records), and outputs "undefined". Anyone has any idea on what I am doing wrong here?
TIA.
gm.