tallone2
02-16-2006, 08:13 PM
spent the last 30 mins searching the boards for an answer to this ...
I'm loading 16000+ records into an array and an i want to provide the user with an indication that something is actually going on. I was hoping to use the ProgressBar and every 100 or so records update the label of the progress bar. Well with the For loop loading into the array nothing happens till its done - so i tried splitting the returned results up and using 2 for loops - a paging type thing. And trying to do a progress bar update between them - call a function - or what ever and nothing is working.
here is a snip of code
aspResponse = unescape(this);
rsArray = aspResponse.split("|");
//remove last element in array - onload function
rsArray.splice(rsArray.length-1, 1);
var maxPage:Number = 0;
var perPage:Number = 100;
var maxIndex = rsArray.length;
var index:Number = 0;
pBar.minimum = 100;
pBar.maximum = maxIndex;
pBar.label = "%1 of %2";
maxPage = Math.round(rsArray.length/perPage)+1;
for (var cPage:Number = 0; cPage<maxPage; cPage++) {
for (var pageIndex:Number = 0; pageIndex<perPage; pageIndex++) {
if (index<rsArray.length) {
recArray = rsArray[index].split("~");
_owner.wellListDP.addItem({label:recArray[0], data:{Index:index, FileNumber:recArray[0], Api:recArray[1], Con:((recArray[2] == "True") ? true : false)}});
if (recArray[2] == "True") {
_owner.configPanel_mc.dataType_list.setPropertiesA t(index, {backgroundColor:0xFF0000});
}
index++;
}
}
pBar.setProgress(index, maxIndex);
//trace('cPage='+cPage+' index='+index+' #='+maxIndex);
}
pBar.visible = false;
_owner.configPanel_mc.dataType_list.dataProvider = _owner.wellListDP;
i've also looked into updateAfterEvent, and setInterval but cannot manage to mesh them with the functionality i want.
any suggestions would be super.
thanks
I'm loading 16000+ records into an array and an i want to provide the user with an indication that something is actually going on. I was hoping to use the ProgressBar and every 100 or so records update the label of the progress bar. Well with the For loop loading into the array nothing happens till its done - so i tried splitting the returned results up and using 2 for loops - a paging type thing. And trying to do a progress bar update between them - call a function - or what ever and nothing is working.
here is a snip of code
aspResponse = unescape(this);
rsArray = aspResponse.split("|");
//remove last element in array - onload function
rsArray.splice(rsArray.length-1, 1);
var maxPage:Number = 0;
var perPage:Number = 100;
var maxIndex = rsArray.length;
var index:Number = 0;
pBar.minimum = 100;
pBar.maximum = maxIndex;
pBar.label = "%1 of %2";
maxPage = Math.round(rsArray.length/perPage)+1;
for (var cPage:Number = 0; cPage<maxPage; cPage++) {
for (var pageIndex:Number = 0; pageIndex<perPage; pageIndex++) {
if (index<rsArray.length) {
recArray = rsArray[index].split("~");
_owner.wellListDP.addItem({label:recArray[0], data:{Index:index, FileNumber:recArray[0], Api:recArray[1], Con:((recArray[2] == "True") ? true : false)}});
if (recArray[2] == "True") {
_owner.configPanel_mc.dataType_list.setPropertiesA t(index, {backgroundColor:0xFF0000});
}
index++;
}
}
pBar.setProgress(index, maxIndex);
//trace('cPage='+cPage+' index='+index+' #='+maxIndex);
}
pBar.visible = false;
_owner.configPanel_mc.dataType_list.dataProvider = _owner.wellListDP;
i've also looked into updateAfterEvent, and setInterval but cannot manage to mesh them with the functionality i want.
any suggestions would be super.
thanks