Gubb
10-06-2008, 02:10 PM
Hi, i'm creating an application where I want to iterate through an array of objects, and update their value in a database, the reading from the database and updating it one post at the time goes without problems, BUT, when i want to update all of the post at the same time, only the last object in the array gets updated.
function updatePos(e:Event):void
{
var tmpLoader:URLLoader = new URLLoader();
for(var i:uint = 0; i <= usrArray.length; i++)
{
var tmpString = "http://localhost:1492/Lab3/Lab3Service.asmx/updatePos?name=" +usrArray[i]._name +"&x=" +usrArray[i].x +"&y=" +usrArray[i].y;
tmpLoader.load(new URLRequest(tmpString));
}
}
Could this be due to some kind of delay/"lag" while contacting the webservice and therefore only the last sent URL-request gets processed correctly ? If that's the case, how could i make sure that the previous request gets completed before the next one starts ?
Thanks. :)
function updatePos(e:Event):void
{
var tmpLoader:URLLoader = new URLLoader();
for(var i:uint = 0; i <= usrArray.length; i++)
{
var tmpString = "http://localhost:1492/Lab3/Lab3Service.asmx/updatePos?name=" +usrArray[i]._name +"&x=" +usrArray[i].x +"&y=" +usrArray[i].y;
tmpLoader.load(new URLRequest(tmpString));
}
}
Could this be due to some kind of delay/"lag" while contacting the webservice and therefore only the last sent URL-request gets processed correctly ? If that's the case, how could i make sure that the previous request gets completed before the next one starts ?
Thanks. :)